TableStar 5

TableStar Delivery: Documentation (DEPRECATED)

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

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.

A full list of all available Java models (including those mentioned in the functions table above) can be found in the Javadoc of the TableStar Model which can be downloaded from software.subshell.com.

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>5.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
  • Append the following to your sophora.delivery.model.packageNames in your sophora.properties to be able to use the models mentioned above:
sophora.delivery.model.packageNames=com.subshell.sophora.sport.deliverymodel.model

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 webapp.sport.context;

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 />
	<!-- the first package 'webapp.sport.context' must match the package of your ContextBridge class  -->
	<context:component-scan base-package="webapp.sport.context,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>
[...]
  • If not already done, add the ContextLoaderListener (after the existing SophoraInitializer) to your WEB-INF/web.xml:
[...]
<listener>
	<listener-class>com.subshell.sophora.delivery.configuration.SophoraInitializer</listener-class>
</listener>
[...]
<listener>
	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
[...]

Example-JSPs

You can find several examples on how to work with the TableStar Delivery Model, in order to access the Java models, in the TableStar Demosite. The Demosite can be downloaded from software.subshell.com.

Last modified on 5/2/22

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

Icon