| Samples > Rule Team Server Authoring Extensions > How to Create and Populate Decision Tables in Rule Team Server |
How to Create and Populate Decision Tables in Rule Team Server |
PREVIOUS NEXT |
This sample shows how to create a decision table in Rule Team Server by copying an existing decision table. The values used to populate the decision table model come from a customized data provider object.
This sample comes with the following providers:
Key features of this sample include:
name, lastChangedBy, createdBy, documentation, and group.
To install this sample:
teamserver > servercopydecisiontable sample.
build command.
This sample can only be opened and run in the Samples Console.
To run this sample:
teamserver > servercopydecisiontable sample.
run command.
This sample is located in <InstallDir>/teamserver/samples/servercopydecisiontable. It contains the following files:
DeleteDecisionTablesinProject.java - The main class that deletes decision tables from the target project. For example, if you re-run the sample, it clears down the target project so that the sample behaves as though you are running it for the first time.
ProjectDeletionArgument.java - The class that holds the arguments that are passed to the DeleteDecisionTablesinProject class.
DTCopyArgument.java - The main class that holds the arguments to be passed.
CopyProjectElements.java - Copies the decision table. It holds the arguments that are passed to the CopyProjectElements class.
DecisionTableLoader.java - The main class that populates a decision table. It loads the configured data source, according to the arguments passed.
DTLoadArgument.java - Holds the arguments that are passed to the DecisionTableLoader class.
JdbcLoader.java - Called when the application uses a JDBC loader. It reads data from a database.
FileLoader.java - Called when the application uses a file loader. It reads data from a file.
ExcelLoader.java - Called when the application uses an Excel loader. It reads data from an Excel spreadsheet.
DataProvider.java - Extends the ilog.rules.dt.model.provider.IlrDTAbstractDataProviderTableModel interface. It is constructed with ilog.rules.studio.samples.dtpopulate.helper.DataLoader. It implements the class and delegates all its work to it. Three factory methods help to create the data loader:
AbstractTabularDataLoader.java - Implements most of the methods defined by DataLoader.java.
RTSHelper.java - The most important class in this sample. It concentrates all the methods that manipulate the Rule Team Server Model.
Project.java - A class representing the Rule Team Server project.
JBOSS40Connection.java - A class holding a connection to a remote Rule Team Server, installed on a JBoss application server.
Connection.java - Represents an abstract connection to Rule Team Server on an application server.
Argument.java - An argument wrapper that defines mandatory data to connect to a Rule Team Server.
Utilities.java - Helps to print to standard output console and manipulate strings.
The highlights of this sample are described in the following sections.
The following arguments are used to delete decision tables:
-targetproject: The target project
-rootfolders: A list of root folders, separated by semi-colons, containing the decision tables to be deleted. For example: path1/subpath; path2/subpath; path3/subpath
-rtsdatasource: The Rule Team Server datasource (jdbc/ilogDataSource)
-rtsurl: URL to connect to Rule Team Server (JBOSS=jnp://localhost:1099)
-rtsuser: Username to connect to Rule Team Server
-rtspwd: Password to connect to Rule Team Server
Decision tables belonging to the passed packages (see the rootfolders argument above) are selected and then deleted. They are selected using the IlrSession.findElements(IlrDefaultSearchCriteria searchCriteria) API. To delete the decision tables, we used the element IlrSession.deleteElement(IlrElementHandle).
The following arguments are used to copy decision tables:
-targetproject: The target project
-sourceproject: The source project
-rootfolders: A list of root folders, separated by semi-colons, containing the decision table to be copied. For example: path1/subpath; path2/subpath; path3/subpat
-rtsdatasource: The Rule Team Server datasource (jdbc/ilogDataSource)
-rtsurl: URL to connect to Rule Team Server (JBOSS=jnp://localhost:1099)
-rtsuser: Username to connect to Rule Team Server
-rtspwd: Password to connect to Rule Team Server
-addDependencies: A list of the projects you want to add as project dependencies, separated by semi-colons
-copySecurity: Specifies whether the source project security is to be copied to the target project
-copyDependencies: Specifies whether the source project dependencies are to be copied to the target project
-copyCategories: Specifies whether the source project categories are to be copied to the target project
-copyParameters: Specifies whether the source project parameters are to be copied to the target project
Each decision table belonging to the folders (and subfolders) that are passed as arguments is selected using the IlrSession.findElements(IlrDefaultSearchCriteria searchCriteria) API. They are then copied to the target project.
The copy process is carried out in several stages:
The following arguments are used to populate decision tables:
targetproject: The target projet
rtsdatasource: The Rule Team Server datasource (jdbc/ilogDataSource)
rtsurl: URL to connect to Rule Team Server (JBOSS=jnp://localhost:1099)
rtsuser: Username to connect to Rule Team Server.
rtspwd: Password to connect to Rule Team Server.
mapping: The mapping file containing the decision table to be loaded with the corresponding datasource.
Populating decision tables is carried out in several stages:
IlrDTController
bankruptcyScore decision table located in the computation folder is populated from a comma-separated csv file.
gradedecision table located in the eligibility folder is populated from an Excel spreadsheet named sheet.
={12,15}: matches the values 12 and 15
={Gold, Silver}: matches if the value is not Gold or Silver
>=15: matches if the value is greater than 15
[15: matches if the value is greater than 15
]15: matches if the value is lower than 15
[10..13]: matches if the value is 10,11,12,13
<otherwise>: represents an Otherwise cell
To rebuild this sample to restore it to its original state:
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |