TableStar | Version 3

TableStar Delivery: Documentation

The TableStar Delivery provides useful functions and models to comfortably access the TableStar content.

Archived documentation for Sophora 3. End-of-support date for this version: 7/25/21

Documentation for Sophora 4

Functions and Models

Function nameMethodsReturn typeDescription
AthleteFunctiontoAthlete(INode node)com.subshell.sophora.sport.model.athlete.AthleteConverts the given INode to a Java model of type Athlete.
DataTableFunctiontoDataTable(INode node)com.subshell.sophora.sport.model.datatable.DataTableConverts the given INode to a Java model of type DataTable.
MatchRoundFunctiontoMatchRound(INode node)com.subshell.sophora.sport.model.round.MatchRoundConverts the given INode to a Java model of type MatchRound.
getMatchRounds()List<com.subshell.sophora.sport.model.round.MatchRound>Finds all match round documents and returns a Java model of type MatchRound for each of them as a list.
ShorthandFunctiontoShorthand(INode node)com.subshell.sophora.sport.model.shorthand.ShorthandConverts the given INode to a Java model of type Shorthand.
SportMenuFunctiontoSportMenu(INode node)com.subshell.sophora.sport.model.menu.SportMenuConverts the given INode to a Java model of type SportMenu.
List<SportMenu> getSportMenus()List<com.subshell.sophora.sport.model.menu.SportMenu>Finds all match round documents and returns a Java model of type SportMenu for each of them as a list.
TeamFunctiontoTeam(INode node)com.subshell.sophora.sport.model.team.TeamConverts the given INode to a Java model of type Team.

Integration

To integrate the TableStar Delivery Model into your delivery you need to do the following steps:

  • Define a maven dependency to the TableStar Delivery Model release you want to use, i.e.
<dependency>
	<groupId>com.subshell.sophora.sport</groupId>
	<artifactId>tablestar-delivery-model</artifactId>
	<version>3.0.0</version>
</dependency>
  • Append the following to your sophora.delivery.function.packageNames in your sophora.properties to be able to use the functions mentioned above:
sophora.delivery.function.packageNames=com.subshell.sophora.sport.deliverymodel.function

In order to be able to initialize the Spring beans of the TableStar Delivery Model you will also need to add the following parts:

  • Add the following Java class to your src folder:

package com.subshell.sophora;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import com.subshell.sophora.delivery.api.DeliveryUtils;

/**
 * Initializes the application context of the delivery.
 */
@Component
public class ContextBridge {

	@Autowired
	private ApplicationContext appContext;

	@PostConstruct
	private void setContext() {
		DeliveryUtils.setRootApplicationContext(appContext);
	}

}
  • In your WEB-INF folder add a new file called tablestar-context.xml with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"	
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans
		http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
		http://www.springframework.org/schema/context
		http://www.springframework.org/schema/context/spring-context-4.1.xsd">

	<context:annotation-config />
	<context:component-scan base-package="com.subshell.sophora,com.subshell.sophora.sport" />
	<context:property-placeholder location="/WEB-INF/sites/sophora.properties" />
</beans>
  • Add the tablestar-context.xml to your WEB-INF/web.xml:
[...]
<context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>/WEB-INF/tablestar-context.xml</param-value>
</context-param>
[...]

Last modified on 3/9/20

The content of this page is licensed under the CC BY 4.0 License. Code samples are licensed under the MIT License.

Icon