Decision Center API

ilog.rules.teamserver.model
Class IlrDefaultSessionController

java.lang.Object
  extended by ilog.rules.teamserver.model.IlrDefaultSessionController
All Implemented Interfaces:
IlrSessionCallback, IlrSessionController

public class IlrDefaultSessionController
extends Object
implements IlrSessionController

IlrDefaultSessionController is the default session controller implementation used by Decision Center.

Overview

A session controller defines the interactive behavior of Decision Center. To keep the default behavior for customized session controller, create a subclass of IlrDefaultSessionController, then enhance only the features you want to change. Each method in your customized session controller class must call its super method whenever possible. For more information, see the session controller example.

About Decision Center API

IBM Decision Center is a rule management server and repository integrated into a J2EE application server. It is used for authoring, managing, validating, and deploying business rules. Using this API you connect to Decision Center and create an IlrSession instance for a specific user. You use the API to do the following:

See Also:
IlrSession, SessionListener, IlrDefaultSearchCriteria

Field Summary
protected  List listeners
          The list of session listeners registered on this controller.
protected  IlrSession session
          The session associated with this controller.
 
Fields inherited from interface ilog.rules.teamserver.model.IlrSessionCallback
CHANGE_ACTIVITY_CONTROLLER_CALLBACK, CONTROLLER_CALLBACK, ISUSERINROLE_CALLBACK, RELEASE_CONTROLLER_CALLBACK, VALIDATION_ACTIVITY_CONTROLLER_CALLBACK
 
Constructor Summary
IlrDefaultSessionController()
           
 
Method Summary
 void addSessionListener(SessionListener l)
          Adds a session listener to the session listeners list.
 void checkCreate(org.eclipse.emf.ecore.EClass eclass)
          Checks whether the current user has the right to create elements of the given class.
 void checkDelete(IlrElementHandle element)
          Checks to see if the current user has the right to delete a specific element.
 void checkUpdate(IlrElementHandle element, IlrElementDetails details, org.eclipse.emf.ecore.EStructuralFeature feature)
          Checks whether the current user has the right to update the given element.
 void elementAddedToBaseline(IlrElementHandle element, IlrBaseline baseline)
          Implements a custom session controller that changes the way in which Decision Center reacts to an action.
 void elementCommitted(IlrCommitableObject cobject, IlrElementHandle newHandle)
          Calls the list of session listeners registered on this controller.
 void elementDeleted(IlrBaseline baseline)
          Calls the list of session listeners registered on this controller.
 void elementDeleted(IlrElementHandle element)
          Calls the list of session listeners registered on this controller.
 void elementDeleted(IlrProjectInfo prjInfo)
          Calls the list of session listeners registered on this controller.
 void elementRemovedFromBaseline(IlrElementHandle element, IlrBaseline baseline)
          Implements a custom session controller that changes the way in which Decision Center reacts to an action.
 Object getInitialValue(IlrElementDetails element, org.eclipse.emf.ecore.EStructuralFeature feature)
          Gets the initial value for the given feature.
protected  ilog.rules.commonbrm.model.IlrInitialValue getInitialValueCallback(org.eclipse.emf.ecore.EStructuralFeature feature)
          Gets the initial value class defined in the Decision Center preferences for the given feature, if any.
 IlrBusinessVersion getNextVersion(boolean isNew, boolean isNewInBranch, IlrBusinessVersion previousVersion)
          Called By RTS when creating or updating an element to get the new version details.
 List getPossibleValues(IlrElementHandle element, org.eclipse.emf.ecore.EStructuralFeature feature)
          Gets the possible values for the given feature.
protected  ilog.rules.commonbrm.model.IlrPropertyExtension getPropertyExtension()
          Gets the property extension class defined in the Decision Center preferences, if any.
 boolean isEditable(IlrElementHandle element, String property)
          Tests whether the given feature for a specific element is editable.
 boolean isHidden(IlrElementHandle element, String property)
          Tests whether the given feature for a specific element must be hidden.
 boolean isServerVisible(IlrServer server, IlrRuleApp ruleApp)
          Called when the list of servers to deploy on is displayed.
 boolean isServerVisible(IlrServer server, IlrScenarioSuite suite)
          This method is called when the list of servers that can be set on the test suite is displayed.
 String isValid(IlrElementHandle element, String feature, Object value)
          Tests whether the given value for a specific feature and element is valid.
 void onAddElementToBaseline(IlrElementHandle element, IlrBaseline baseline)
          Implements a custom session controller that changes the way in which Decision Center reacts to an action.
 void onCheckRulesetArchive(ilog.rules.archive.IlrRulesetArchive rulesetArchive, IlrBaseline baseline, IlrSearchCriteria ruleArtifactquery, ilog.rules.commonbrm.extractor.IlrExtractorValidator extractorValidator, List generationErrors)
          This method does nothing in this default implementation.
 void onCommitElement(IlrCommitableObject cobject)
          Passes the element to the onCommitElement method of the SessionListener attached to this session controller.
 void onDeleteElement(IlrElementHandle element)
          Passes the element to the onDeleteElement method of the SessionListener attached to this session controller.
 void onGenerateRulesetArchive(ilog.rules.engine.IlrRulesetArchiveBuilder rulesetArchiveBuilder, IlrBaseline baseline, IlrSearchCriteria ruleArtifactquery, ilog.rules.commonbrm.extractor.IlrExtractorValidator extractorValidator)
          This method does nothing in this default implementation.
 void onRemoveElementFromBaseline(IlrElementHandle element, IlrBaseline baseline)
          Implements a custom session controller that changes the way in which Decision Center reacts to an action.
 IlrSearchCriteria redefineSearch(IlrSearchCriteria searchCriteria)
          Called each time a search is performed using search criteria.
 void removeSessionListener(SessionListener l)
          Removes a session listener from the session listeners list.
 void securityProfileCommitted(String role, IlrSecurityProfileData profile)
          Called when new permissions for a given role have been committed.
 void securityProfileDeleted(String role)
          Called when permissions for a given role have been deleted.
 void setSession(IlrSession dataProvider)
          Sets the session for this callback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected IlrSession session
The session associated with this controller.


listeners

protected List listeners
The list of session listeners registered on this controller.

Constructor Detail

IlrDefaultSessionController

public IlrDefaultSessionController()
Method Detail

setSession

public void setSession(IlrSession dataProvider)
Description copied from interface: IlrSessionCallback
Sets the session for this callback.

This method is called just after a user connects to a session.

Specified by:
setSession in interface IlrSessionCallback
Parameters:
dataProvider - The session.
See Also:
IlrSessionFactory.connect(String, String, String, String), Overview

checkUpdate

public void checkUpdate(IlrElementHandle element,
                        IlrElementDetails details,
                        org.eclipse.emf.ecore.EStructuralFeature feature)
                 throws IlrPermissionException,
                        IlrObjectNotFoundException
Description copied from interface: IlrSessionController
Checks whether the current user has the right to update the given element.

Decision Center calls this method in several places. It is called by the Decision Center GUI front end to check if:

It is also called at the beginning of the commit method to check if the details of an edited object can be committed.

Specified by:
checkUpdate in interface IlrSessionController
Throws:
IlrPermissionException - if the current user does not have the rights to change element.
IlrObjectNotFoundException - if feature is not found in the Decision Center database.
Parameters:
element - The element handle. This parameter may be set to null.
details - The object that will be committed if this method does not throw any exceptions. This parameter may be set to null.
feature - The feature to modify. If set to null, you should consider whether the entire object can be modified in your custom session controller.
See Also:
Overview

checkDelete

public void checkDelete(IlrElementHandle element)
                 throws IlrPermissionException,
                        IlrObjectNotFoundException
Checks to see if the current user has the right to delete a specific element.

Specified by:
checkDelete in interface IlrSessionController
Throws:
IlrPermissionException - if the current user does not have the right to delete element.
IlrObjectNotFoundException - if element cannot be found in the Decision Center database.
Parameters:
element - The element handle.
See Also:
Session Controllers

checkCreate

public void checkCreate(org.eclipse.emf.ecore.EClass eclass)
                 throws IlrPermissionException,
                        IlrObjectNotFoundException
Checks whether the current user has the right to create elements of the given class.

Implements a custom session controller to change the way Decision Center reacts to this action.

Specified by:
checkCreate in interface IlrSessionController
Throws:
IlrPermissionException - If the current user does not have the right to create eclass
IlrObjectNotFoundException - If element cannot be found in the Decision Center database.
Parameters:
eclass - The element class.
See Also:
Session Controllers

isHidden

public boolean isHidden(IlrElementHandle element,
                        String property)
                 throws IlrObjectNotFoundException
Description copied from interface: IlrSessionController
Tests whether the given feature for a specific element must be hidden.

This method is used in the UI to test if the current user has the rights to see the feature.

Specified by:
isHidden in interface IlrSessionController
Throws:
IlrObjectNotFoundException - If element is not found in the database.
Parameters:
element - The element handle.
property - The feature to test.
Returns:
True if feature is hidden.
See Also:
Overview

isEditable

public boolean isEditable(IlrElementHandle element,
                          String property)
                   throws IlrObjectNotFoundException
Description copied from interface: IlrSessionController
Tests whether the given feature for a specific element is editable.

This method is used in the UI to check if feature may be edited by the current user.

Specified by:
isEditable in interface IlrSessionController
Throws:
IlrObjectNotFoundException - If an object is not found in the database.
Parameters:
element - The element handle.
property - The feature to test.
Returns:
True if feature is editable.
See Also:
Overview

onCheckRulesetArchive

public void onCheckRulesetArchive(ilog.rules.archive.IlrRulesetArchive rulesetArchive,
                                  IlrBaseline baseline,
                                  IlrSearchCriteria ruleArtifactquery,
                                  ilog.rules.commonbrm.extractor.IlrExtractorValidator extractorValidator,
                                  List generationErrors)
This method does nothing in this default implementation.

Implements a custom session controller to change the way Decision Center reacts to this action.

Specified by:
onCheckRulesetArchive in interface IlrSessionController
Parameters:
rulesetArchive - The ruleset archive that has been generated.
baseline - The baseline from which the execution artifacts were extracted.
ruleArtifactquery - The query used to get the rule artifacts to be extracted. This parameter can be set to null.
extractorValidator - The extractor validator used to filter out the artifacts to be extracted.
generationErrors - A list of IlrElementError.
See Also:
IlrElementError, IlrDeploymentFacility.generateRulesetArchive(IlrSearchCriteria, String, String), Session Controllers

redefineSearch

public IlrSearchCriteria redefineSearch(IlrSearchCriteria searchCriteria)
Description copied from interface: IlrSessionController
Called each time a search is performed using search criteria.

A typical use is to modify the search according to the role of the user. For example, you could redefine a search such that the current user can only view the rules with the status 'new'. In this case, you will return a new search criterion that will add (status, 'new') to the list of features and values of the input search criteria.

Note: Do not modify and return searchCriteria. You must do one of the following:

Specified by:
redefineSearch in interface IlrSessionController
Parameters:
searchCriteria - The search criteria passed when one of the IlrSession.findElements methods is called.
Returns:
Either a new IlrSearchCriteria instance with overridden criteria, or searchCriteria.

onDeleteElement

public void onDeleteElement(IlrElementHandle element)
                     throws IlrApplicationException
Passes the element to the onDeleteElement method of the SessionListener attached to this session controller.

Specified by:
onDeleteElement in interface IlrSessionController
Throws:
IlrApplicationException
Parameters:
element - The object to be deleted.
See Also:
addSessionListener(SessionListener), IlrSession.deleteElement(IlrElementHandle), Session Controllers

onCommitElement

public void onCommitElement(IlrCommitableObject cobject)
                     throws IlrApplicationException
Passes the element to the onCommitElement method of the SessionListener attached to this session controller.

Specified by:
onCommitElement in interface IlrSessionController
Throws:
IlrApplicationException
IlrObjectNotFoundException - if cobject is not found in the database.
IlrPermissionException - if the current user does not have the rights to commit cobject.
IlrInvalidElementException - if cobject is invalid. For example, if the name of a project element is null.
IlrActivityObjectLockedException
Parameters:
cobject - The object to be committed.
See Also:
addSessionListener(SessionListener), IlrSession.commit(IlrCommitableObject), Session Controllers

onGenerateRulesetArchive

public void onGenerateRulesetArchive(ilog.rules.engine.IlrRulesetArchiveBuilder rulesetArchiveBuilder,
                                     IlrBaseline baseline,
                                     IlrSearchCriteria ruleArtifactquery,
                                     ilog.rules.commonbrm.extractor.IlrExtractorValidator extractorValidator)
This method does nothing in this default implementation.

Implements a custom session controller to change the way in which Decision Center reacts to this action.

Specified by:
onGenerateRulesetArchive in interface IlrSessionController
Parameters:
rulesetArchiveBuilder - The ruleset archive builder, ready to generate a ruleset archive. It contains the execution artifacts resulting from the extraction of the ruleset being generated.
baseline - The baseline from which the execution artifacts were extracted.
ruleArtifactquery - The query used to get the rule artifacts to be extracted. This parameter can be set to null.
extractorValidator - The extractor validator used to filter out the artifacts to be extracted.
See Also:
IlrDeploymentFacility.generateRulesetArchive(IlrSearchCriteria, String, String), Session Controllers

isValid

public String isValid(IlrElementHandle element,
                      String feature,
                      Object value)
               throws IlrObjectNotFoundException
Description copied from interface: IlrSessionController
Tests whether the given value for a specific feature and element is valid.

This method is used in the UI to check if value can be entered by the current user.

Specified by:
isValid in interface IlrSessionController
Throws:
IlrObjectNotFoundException - If an object is not found in the database.
Parameters:
element - The element handle.
feature - The feature to test.
Returns:
An error message when the value is not valid, null otherwise.
See Also:
Overview

getPossibleValues

public List getPossibleValues(IlrElementHandle element,
                              org.eclipse.emf.ecore.EStructuralFeature feature)
                       throws IlrObjectNotFoundException
Description copied from interface: IlrSessionController
Gets the possible values for the given feature.

Optionally, the element for which the framework wants the possible values can be given. This allows implementors to dynamically compute the possible values according to the current state of the element.

Specified by:
getPossibleValues in interface IlrSessionController
Throws:
IlrObjectNotFoundException - if feature is not found in the Decision Center database.
Parameters:
element - The element handle. This parameter may be set to null.
feature - The feature whose possible values you want to retrieve. This must be an attribute whose type is enumerated (EEnum).
Returns:
A list of the possible values. This method cannot return null. Set your custom implementation to return List.EMPTY_LIST if there are no possible values to return.
See Also:
Overview

getInitialValue

public Object getInitialValue(IlrElementDetails element,
                              org.eclipse.emf.ecore.EStructuralFeature feature)
                       throws IlrObjectNotFoundException
Description copied from interface: IlrSessionController
Gets the initial value for the given feature.

Specified by:
getInitialValue in interface IlrSessionController
Throws:
IlrObjectNotFoundException - if feature is not found in the Decision Center database.
Parameters:
element - The element handle. This parameter may be set to null.
feature - The feature whose initial value is to be returned.
Returns:
The initial value for the object. May return null.
See Also:
Overview

elementCommitted

public void elementCommitted(IlrCommitableObject cobject,
                             IlrElementHandle newHandle)
                      throws IlrApplicationException
Calls the list of session listeners registered on this controller.

Specified by:
elementCommitted in interface IlrSessionController
Throws:
IlrApplicationException
IlrObjectNotFoundException - if object is not found in the database.
Parameters:
cobject - The committed object.
See Also:
IlrSession.commit(IlrCommitableObject), Overview

elementDeleted

public void elementDeleted(IlrElementHandle element)
                    throws IlrObjectNotFoundException
Calls the list of session listeners registered on this controller.

Specified by:
elementDeleted in interface IlrSessionController
Throws:
IlrObjectNotFoundException - if element is not found in the database.
Parameters:
element - The deleted object.
See Also:
IlrSession.deleteElement(IlrElementHandle), Overview

elementDeleted

public void elementDeleted(IlrBaseline baseline)
                    throws IlrObjectNotFoundException
Calls the list of session listeners registered on this controller.

Specified by:
elementDeleted in interface IlrSessionController
Throws:
IlrObjectNotFoundException - if baseline is not found in the database.
Parameters:
baseline - The deleted baseline.
See Also:
IlrSession.deleteElement(IlrElementHandle), Overview

elementDeleted

public void elementDeleted(IlrProjectInfo prjInfo)
                    throws IlrObjectNotFoundException
Calls the list of session listeners registered on this controller.

Specified by:
elementDeleted in interface IlrSessionController
Throws:
IlrObjectNotFoundException - if prjInfo is not found in the database.
Parameters:
prjInfo - The deleted project info.
See Also:
IlrSession.deleteElement(IlrElementHandle), Overview

addSessionListener

public void addSessionListener(SessionListener l)
Adds a session listener to the session listeners list.

Parameters:
l - The session listener.

removeSessionListener

public void removeSessionListener(SessionListener l)
Removes a session listener from the session listeners list.

Parameters:
l - The session listener.

elementAddedToBaseline

public void elementAddedToBaseline(IlrElementHandle element,
                                   IlrBaseline baseline)
                            throws IlrApplicationException
Description copied from interface: IlrSessionController
Implements a custom session controller that changes the way in which Decision Center reacts to an action. This method is called just after an element has been added to a baseline.

Specified by:
elementAddedToBaseline in interface IlrSessionController
Throws:
IlrApplicationException - if element cannot be added to baseline.
Parameters:
element - The element to add.
baseline - The baseline to update.
See Also:
IlrBaselineManagementFacility.addToBaseline(IlrElementHandle, IlrBaseline), Overview

elementRemovedFromBaseline

public void elementRemovedFromBaseline(IlrElementHandle element,
                                       IlrBaseline baseline)
                                throws IlrApplicationException
Description copied from interface: IlrSessionController
Implements a custom session controller that changes the way in which Decision Center reacts to an action. This method is called just after an element has been removed from a baseline.

Specified by:
elementRemovedFromBaseline in interface IlrSessionController
Throws:
IlrApplicationException - if element cannot be removed from baseline.
Parameters:
element - The element that has been removed.
baseline - The baseline to update.
See Also:
IlrBaselineManagementFacility.addToBaseline(IlrElementHandle, IlrBaseline), Overview

onAddElementToBaseline

public void onAddElementToBaseline(IlrElementHandle element,
                                   IlrBaseline baseline)
                            throws IlrApplicationException
Description copied from interface: IlrSessionController
Implements a custom session controller that changes the way in which Decision Center reacts to an action. This method is called on entering the IlrSession.addToBaseline method, just before the element is added to a baseline.

Specified by:
onAddElementToBaseline in interface IlrSessionController
Throws:
IlrApplicationException - if element cannot be added to baseline.
Parameters:
element - The element to be added.
baseline - The baseline to be updated.
See Also:
IlrBaselineManagementFacility.addToBaseline(IlrElementHandle, IlrBaseline), Overview

onRemoveElementFromBaseline

public void onRemoveElementFromBaseline(IlrElementHandle element,
                                        IlrBaseline baseline)
                                 throws IlrApplicationException
Description copied from interface: IlrSessionController
Implements a custom session controller that changes the way in which Decision Center reacts to an action. This method is called on entering the IlrSession.removeFromBaseline method, just before the element is removed from a baseline.

Specified by:
onRemoveElementFromBaseline in interface IlrSessionController
Throws:
IlrApplicationException - if element cannot be removed from baseline.
Parameters:
element - The element to be removed.
baseline - The baseline to be updated.
See Also:
IlrBaselineManagementFacility.addToBaseline(IlrElementHandle, IlrBaseline), Overview

getPropertyExtension

protected ilog.rules.commonbrm.model.IlrPropertyExtension getPropertyExtension()
Gets the property extension class defined in the Decision Center preferences, if any.

Returns:
The instance of IlrPropertyExtension, or null if no property extension has been defined.

getInitialValueCallback

protected ilog.rules.commonbrm.model.IlrInitialValue getInitialValueCallback(org.eclipse.emf.ecore.EStructuralFeature feature)
Gets the initial value class defined in the Decision Center preferences for the given feature, if any.

Returns:
The instance of IlrInitialValue, or null if no initial value class has been defined.

isServerVisible

public boolean isServerVisible(IlrServer server,
                               IlrRuleApp ruleApp)
Description copied from interface: IlrSessionController
Called when the list of servers to deploy on is displayed.

Implements a custom session controller to filter the displayed servers.

Specified by:
isServerVisible in interface IlrSessionController
Parameters:
server - The server to manage.
ruleApp - The RuleApp to deploy.
Returns:
True if the server must be displayed, false otherwise.

isServerVisible

public boolean isServerVisible(IlrServer server,
                               IlrScenarioSuite suite)
Description copied from interface: IlrSessionController
This method is called when the list of servers that can be set on the test suite is displayed.

Implements a custom session controller to filter the displayed servers.

Specified by:
isServerVisible in interface IlrSessionController
Parameters:
server - The server to manage.
suite - The test suite.
Returns:
True if the server must be displayed, false otherwise.

securityProfileCommitted

public void securityProfileCommitted(String role,
                                     IlrSecurityProfileData profile)
Description copied from interface: IlrSessionController
Called when new permissions for a given role have been committed.

Specified by:
securityProfileCommitted in interface IlrSessionController
Parameters:
role - The role on which the permissions have changed.
profile - The permissions that have been committed.

securityProfileDeleted

public void securityProfileDeleted(String role)
Description copied from interface: IlrSessionController
Called when permissions for a given role have been deleted.

Specified by:
securityProfileDeleted in interface IlrSessionController
Parameters:
role - The role on which the permissions have been deleted.

getNextVersion

public IlrBusinessVersion getNextVersion(boolean isNew,
                                         boolean isNewInBranch,
                                         IlrBusinessVersion previousVersion)
Description copied from interface: IlrSessionController
Called By RTS when creating or updating an element to get the new version details.

Specified by:
getNextVersion in interface IlrSessionController
Parameters:
isNew - true if this is a new element to create
isNewInBranch - true if the element is updated for the first time in working branch
previousVersion - latest element version in working branch hierarchy, null if this is a new element
Returns:
the version to set for the element update.

Decision Center API

© Copyright IBM Corp. 1987, 2013