Package ilog.rules.teamserver.model

Defines the API you use to access and control Decision Center data and services.

See: Description

Package ilog.rules.teamserver.model Description

Defines the API you use to access and control Decision Center data and services.

Overview

Decision Center is a rule management server and repository integrated into a J2EE application server. It is used for authoring, managing, validating, and deploying rule projects containing business rules. IlrSession is the main entry point to Decision Center. You use this class to do the following:

  • Search the Decision Center repository
  • Execute an action query
  • Create new elements such as projects, packages, and rules
  • Retrieve, commit, and lock elements
  • Manage baselines

An element in Decision Center is any object contained in a rule project. For example, a rule, a ruleflow, a decision table, a business object model, a query, or a template. The Eclipse Modeling Framework (EMF) is used in Decision Center to define the rule model, that is, the set of elements that are managed in a rule project, and their associated properties. All elements are instances of an EMF class defined by the EClass interface. Properties are represented by the EStructuralFeature interface. Call getPropertyValue(String) and getPropertyValue(EStructuralFeature) to retrieve the property values of an element. See the EMF documentation for more information.

All rule artifacts are instances of the IlrElement interface. You manipulate Decision Center artifacts using the following interfaces:

NameDescriptionScope
IlrElementHandle The base interface for all elements Retrieve from server
IlrElementSummary Contains the name of the element only. Mainly used for GUI applications Retrieve from server
IlrElementDetails Contains all information contained in an element. Can be cast directly to a type such as IlrRule Retrieve from server
IlrCommitableObject Any element that will be added to the repository Add to server

Use an IlrSessionFactory instance to connect to the Decision Center, and then retrieve an IlrSession instance by calling IlrSessionFactory.getSession.

All session objects are stateful, that is, they are always associated with the user whose credentials were given when connect was called. See IlrSession for a code example of how to create a user session using the API.

Rule Projects

A rule project corresponds to a specific organization of rules. Rule projects are stored in the repository. A repository can contain many rule projects, but rule projects are displayed one at a time in Decision Center. Rule projects can, however, be set up to reference other projects in the repository. The following code example shows how to create an empty rule project using the API:

         //Create Project
         String projectName = "testProject";
         IlrRuleProject testProject = null;
         IlrRuleProject workingProject = 
                (IlrRuleProject)IlrSessionHelper.getProjectNamed(session, projectName);
         if (workingProject!=null) {
           testProject = workingProject;
           session.eraseProject(testProject);
           System.out.println("Project Deleted"); 
         }
         testProject = 
           (IlrRuleProject)IlrSessionHelper.createRuleProject(
                        session, projectName);
 

Note: This code example uses IlrSessionHelper to interact with Decision Center.

Versions and Baselines

Decision Center keeps track of all the changes made to any project element by storing all the versions of each element.

Baselines correspond to a snapshot of the state of a project at a given moment in time. A project can contain many baselines, all of which you can consult. You can restore a baseline if required.

When a user connects to Decision Center, for your custom application to work correctly, it is essential that you set the baseline for the current user. The following code example shows how to set the baseline for a user:

  String project = "loanvalidation-rules";
  // get the project by name
  IlrRuleProject ruleProject = (IlrRuleProject) IlrSessionHelper.getProjectNamed(session, project);
  // open current baseline
  IlrBaseline currentBaseline = IlrSessionHelper.getCurrentBaseline(session, ruleProject);
  session.setWorkingBaseline(currentBaseline);

The following code example shows how to create a baseline from the state of the elements in the current rule project.

   Date today = new Date();
   String baselineName = "testBaseline" + today.toString();
   IlrBaseline newBaseline = session.createBaselineFromCurrentState(baselineName);
 
See
IlrSession for a more complete example.

Project Security and User Behavior

Decision Center security means restricting user access to a given project. When security is not enforced on a project, any user of Decision Center can create, update, view, or delete any of the elements in that project. When you enforce security on a project, you specify which groups can access the project. When a user signs in, Decision Center evaluates what the user can do, based on which groups the current user belongs to. The default groups are as follows:

UserDescription
rtsUser Can manipulate data in the Explore, Query, and Compose tabs
rtsConfigManager Has rtsUser rights plus control of configuration data in the Configure tab
rtsAdministrator Has full control of all aspects of Decision Center

When the current user tries to modify an element inside a rule project using either the web GUI or via a custom application, session controller methods are called to control the way Decision Center reacts. The default session controller implementation used by Decision Center is IlrDefaultSessionController.

You customize the security settings of Decision Center by creating a subclass of IlrDefaultSessionController. For example, you can create a custom session controller that logs the actions of each user to a file or database. See IlrSessionController for an example of of how to create a custom session controller.

In order for Decision Center to take your customized session controller into account, you must register your new implementation in one of the following ways:

  • by setting the teamserver.controller.class parameter in the preferences.properties file. For more information, see the serveractionnotification sample in the Samples Console.
  • through the setConfigParam ant task

Note: You should create a subclass of IlrDefaultSessionController when you customize Decision Center behavior and not IlrSessionController directly.

You need at least rtsConfigManager rights to:

Also, you need at least rtsAdministrator rights to:

However, note that when using the IlrSession API, some actions are less restrictive than when using the Decision Center Enterprise console. Specifically, the rtsUser can, for example:

  • Create ruleset extractors
  • Create RuleApps
  • Create servers
  • Edit project dependencies
Decision Center API

© Copyright IBM Corp. 1987, 2015