Decision Center API

ilog.rules.teamserver.model
Interface IlrSession

All Superinterfaces:
ActivityLockingFacility, IlrBaselineManagementFacility, IlrDeploymentFacility, IlrLockingFacility, IlrModelConstants, IlrPermissionsFacility, IlrTestingFacility, Serializable

public interface IlrSession
extends Serializable, IlrLockingFacility, ActivityLockingFacility, IlrPermissionsFacility, IlrBaselineManagementFacility, IlrDeploymentFacility, IlrTestingFacility, IlrModelConstants

Allows you to connect a registered user to Decision Center. The user can then read data from or write data to the server.

Overview

All session objects are stateful, that is, they are always associated with the user whose credentials were given when connect was called. See Project Security for more information. Use an IlrSessionFactory instance to connect to Decision Center and return an IlrSession instance.

Example

The following code example shows how to connect to the Decision Center and run a query on the server from a client Java application:

   String serverUrl = "http://localhost:9080/teamserver";
   String datasource = "jdbc/ilogDataSource";
   String login = "rtsAdmin";
   String password = "rtsAdmin";
   String project = "loanvalidation-rules";

   IlrSessionFactory factory = new IlrRemoteSessionFactory();
   try {
     factory.connect(login, password, serverUrl, datasource);
     IlrSession session = factory.getSession();

     // get the project by name
     IlrRuleProject ruleProject = (IlrRuleProject) IlrSessionHelper.getProjectNamed(session, project);
     // open current baseline
     IlrBaseline currentBaseline = IlrSessionHelper.getCurrentBaseline(session, ruleProject);
     session.setWorkingBaseline(currentBaseline);
     String query = new String("Find all business rules such that "
                                        + "the last modification date of each "
                                        + "business rule is after 10/27/05 2:55:25 PM");
     IlrDefaultSearchCriteria criteria = new IlrDefaultSearchCriteria(
                                        query.toString());
     List summaries = session.findElements(criteria, IlrModelConstants.ELEMENT_SUMMARY);

     for (int i = 0; i < summaries.size(); i++) {
       IlrElementSummary ruleSummary = (IlrElementSummary) summaries.get(i);
       String ruleName = ruleSummary.getName();
       System.out.println("\t" + ruleName);
     }
     session.close();
   }
   catch (IlrConnectException cE)
   {
     cE.printStackTrace();
   }
 

See Also:
IlrSessionHelper, IlrSessionFactory, IlrSessionController, IlrExtractorValidator, IlrSearchCriteria

Field Summary
 
Fields inherited from interface ilog.rules.teamserver.model.IlrDeploymentFacility
DEPLOY, INC_MAJOR, INC_MAJOR_RULESET, INC_MINOR, INC_MINOR_RULESET, REDEPLOY, REPLACE_RULEAPP, REPLACE_RULESET
 
Fields inherited from interface ilog.rules.teamserver.model.IlrModelConstants
CURRENT_BASELINE_NAME, DEFAULT_EXTRACTORVALIDATOR, DEFAULT_SCOPE, DEFAULT_SSPRESOLVER, ELEMENT_COMMITABLE_OBJECT, ELEMENT_DETAILS, ELEMENT_HANDLE, ELEMENT_SUMMARY, RECYCLEBIN_BASELINE, SCOPE_PROJECT, SCOPE_PROJECT_AND_DEPENDENCIES
 
Method Summary
 void beginUsage()
          Begin the work on this session.
 void close()
          Closes the session.
 IlrElementHandle commit(IlrCommitableObject cobject)
          Commits the given committable object with all its attached elements, to Decision Center.
 IlrElementHandle commit(IlrElementDetails details)
          Commits the given element details.
 List<IlrElementHandle> commit(List commitableObjects)
          Commits the given list of committable objects.
 IlrElementHandle copyTo(IlrElementHandle sourceElement, IlrElementVersion elementVersion, IlrElementDetails target, boolean recursive, String duplicatePrefix)
          Copies an element or one of its versions in a package.
 IlrElementHandle copyTo(IlrElementHandle sourceElement, IlrElementVersion elementVersion, IlrElementDetails target, IlrBaseline branch, boolean recursive, String duplicatePrefix)
          Copies an element or one of its versions in a package.
 List copyTo(List sourceElements, IlrElementDetails target, boolean recursive, String duplicatePrefix)
          Copies a list of elements in a package.
 List copyTo(List sourceElements, IlrElementDetails target, IlrBaseline branch, boolean recursive, String duplicatePrefix)
          Copies a list of elements in a package.
 IlrElementHandle createElement(org.eclipse.emf.ecore.EClass eclass)
          Creates a handle for the given EMF class.
 void deleteElement(IlrElementHandle element)
          Deletes the given element from the working project.
 void deleteElement(IlrElementHandle element, boolean recursive)
          Deletes the given element from the working project recursively on request.
 void deleteElements(List<? extends IlrElementHandle> elements)
          Deletes the given list of elements from the working project.
 void deleteElements(List<? extends IlrElementHandle> elements, boolean recursive)
          Deletes the given list of elements from the working project recursively, if requested.
 String elementHandleToString(IlrElementHandle element)
          Returns a string serialization of the given element.
 void endUsage()
          End the work on this session.
 void eraseProject(IlrRuleProject ruleProject)
          Erases a project from the database.
 int executeQuery(IlrSearchCriteria searchCriteria)
          Finds the elements matching the given search criteria and executes the action defined in the query.
 List<IlrCommitableObject> findElementCommitableObjects(IlrSearchCriteria searchCriteria)
          Same function as List findElements(IlrSearchCriteria searchCriteria, int returnedObjectFormat), returning IlrCommitableObject elements.
 List<IlrElementDetails> findElementDetails(IlrSearchCriteria searchCriteria)
          Same function as List findElements(IlrSearchCriteria searchCriteria, int returnedObjectFormat), returning IlrElementDetails elements.
 List<IlrElementHandle> findElementHandles(IlrSearchCriteria searchCriteria)
          Same function as List findElements(IlrSearchCriteria searchCriteria, int returnedObjectFormat), returning IlrElementHandle elements.
 List findElements(IlrSearchCriteria searchCriteria)
          Returns the list of elements matching the given search criteria.
 List findElements(IlrSearchCriteria searchCriteria, int returnedObjectFormat)
          Returns the elements stored in Decision Center that match the given search criteria.
 List<IlrBaseline> getAccessibleBaselines(IlrElementHandle ruleProjectHandle)
          Returns the baselines for given rule project that can be accessed by the current user for this session.
 List<IlrBaseline> getAccessibleChildrenBaselines(IlrBaseline parentBaseline)
          Returns the baselines that are children of the one given as a parameter and that can be accessed by the current user for this session.
 List<IlrRuleProject> getAccessibleProjects()
          Returns the projects that can be accessed by the current user for this session.
 Object getAttribute(String name)
          Returns the object bound with the specified name in this session.
 Iterator<String> getAttributeNames()
          Returns an Iterator of String objects containing the names of all the objects bound to this session.
 IlrBrmPackage getBrmPackage()
          Gets the EMF package containing the Decision Center classes and data types.
 IlrElementDetails getElementDetails(IlrElementHandle handle)
          Returns the details for the element in Decision Center that corresponds to the given handle.
 IlrElementDetails getElementDetails(IlrElementHandle handle, IlrElementVersion version)
          Returns the details of the given element for the given version of the element.
 IlrElementDetails getElementDetailsForThisHandle(IlrElementHandle handle)
          Returns the details that correspond to the exact version of the given element handle.
 IlrElementDetails getElementDetailsInWorkingBaseline(IlrElementHandle handle)
          Returns the details of the given element in the working baseline.
 List getElementsFromReference(IlrElementHandle handle, org.eclipse.emf.ecore.EReference reference, IlrElementVersion version, int returnedObjectFormat)
          Returns the value of the given reference for the given version of the given element.
 List getElementsFromReference(IlrElementHandle handle, org.eclipse.emf.ecore.EReference reference, int returnedObjectFormat)
          Returns the value of the reference for the given element.
 List getElementsFromReference(IlrElementHandle handle, org.eclipse.emf.ecore.EReference reference, int returnedObjectFormat, org.eclipse.emf.ecore.EStructuralFeature orderBy)
          Returns the value of the reference for the given element.
 IlrElementSummary getElementSummary(IlrElementHandle handle)
          Returns the summary for the given element handle.
 IlrElementSummary getElementSummary(IlrElementHandle handle, IlrElementVersion version)
          Returns the summary of the given element for the given version of the element.
 IlrElementSummary getElementSummaryForThisHandle(IlrElementHandle handle)
          Returns the summary that correspond to the exact version of the given element handle.
 IlrElementVersion getElementVersion(IlrElementHandle element)
          Returns the version information corresponding to the given element.
 IlrElementVersion getElementVersion(IlrElementHandle element, IlrElementHandle baseline)
          Returns the version of the given element that is referenced by the given baseline.
 List<IlrElementVersion> getElementVersions(IlrElementHandle element)
          Returns a list containing all versions of a given element stored in Decision Center.
 String[] getHierarchyPath(IlrElementHandle handle)
          Returns the hierarchy path of a rule package, that is, a folder.
 Date getLoginDate()
          Returns the date the user connected with this session logged into Decision Center.
 IlrModelInfo getModelInfo()
          Returns the model info object describing the business rule model of Decision Center.
 List getPossibleValues(IlrElementHandle element, org.eclipse.emf.ecore.EStructuralFeature feature)
          Returns the possible values for the given element and feature.
 Locale getReferenceLocale()
          Returns the reference locale.
 Locale getUserLocale()
          Returns The locale for the current user.
 String getUserName()
          Returns the name of the user connected with this session.
 IlrBaseline getWorkingBaseline()
          Returns the working baseline.
 ilog.rules.bom.IlrObjectModel getWorkingBOM()
          Returns the Business Object Model (BOM) for the current baseline.
 ilog.rules.brl.brldf.IlrBRLVariableProvider getWorkingVariableProvider()
          Returns the variable provider for the working baseline.
 ilog.rules.vocabulary.model.IlrVocabularyManager getWorkingVocabulary()
          Returns the vocabulary manager for the working baseline.
 boolean isUserInRole(String role)
          Indicates whether the user has the given role.
 boolean reloadDynamicDomains()
          Reloads all the dynamic domains present in the BOM.
 Object removeAttribute(String name)
          Removes the object bound with the specified name from this session.
 void restoreVersion(IlrElementHandle element, IlrElementVersion elementVersion)
          Restores the given version of the given element.
 void setAttribute(String name, Object value)
          Binds an object to this session, using the name specified.
 void setUserLocale(Locale locale)
          Sets the locale for the current user.
 void setWorkingBaseline(IlrBaseline baseline)
          Sets the working baseline for this session.
 IlrElementHandle stringToElementHandle(String idString)
          Returns the element handle corresponding to the given string.
 
Methods inherited from interface ilog.rules.teamserver.model.IlrLockingFacility
checkIsElementBusy, clearAllLocks, clearNonPersistentLocks, getLockOwner, getRootLockedElementForElement, isElementBusy, isPersistentLock, lockBranches, lockElement, lockElement, lockElements, ownsLock, releaseElementLock, releaseElementLocks, releaseNonPersistentLocks, unlockBranches, unlockElement, unlockElements
 
Methods inherited from interface ilog.rules.teamserver.model.ActivityLockingFacility
eltNameLockVisible, getActivityLockOwner, isActivityElementBusy, lockActivityElement, ownsActivityLock, releaseActivityLock, unlockActivityElements
 
Methods inherited from interface ilog.rules.teamserver.model.permissions.IlrPermissionsFacility
checkPermissionCreate, checkPermissionDelete, checkPermissionUpdate, checkPermissionView, commitSecurityProfileData, eraseSecurityProfile, getAvailableGroups, getPermissionableClasses, getSecurityProfileData, isEditable, isHidden, setAvailableGroups
 
Methods inherited from interface ilog.rules.teamserver.model.IlrBaselineManagementFacility
addToBaseline, changeVersionInBaseline, cloneToBranch, cloneToBranch, copyBaseline, createBaselineFromCurrentState, createBaselineFromCurrentState, createBaselineFromCurrentState, createBaselineFromCurrentState, createBranchFromCurrentState, createSnapshotFromBaselineEvent, createSnapshotFromElement, createSnapshotFromElementVersion, deleteBaseline, deleteFromBranch, findArtifactsCausingMergeConflicts, findArtifactsDeletedReadyToMerge, findArtifactsReadyToMerge, getBaselinesForVersion, removeFromBaseline, restoreBaseline, restoreBaseline
 
Methods inherited from interface ilog.rules.teamserver.model.IlrDeploymentFacility
deployEventProject, deployRuleAppArchive, generateRuleAppArchive, generateRulesetArchive
 
Methods inherited from interface ilog.rules.teamserver.model.IlrTestingFacility
executeScenarioSuite, generateScenarioSuiteArchive
 

Method Detail

beginUsage

void beginUsage()
Begin the work on this session. After the call, the IlrSession object is bound to the current thread. If this method is not called, you will not be able to use objects returned by the IlrSession (for example IlrElementHandle.getValue(EStructuralFeature) with throw an IllegalStateException if beginUsage has not been called). the following idiom should be used: IlrSession session = factory.getSession(); try { session.beginUsage(); // do some work ... } finally { session.endUsage(); }


endUsage

void endUsage()
End the work on this session. After the call, the IlrSession object is unbound to the current thread. If this method is not called the IlrSession object will stay attached to the current thread and can be the cause of a memory leak in an application server context.


findElements

List findElements(IlrSearchCriteria searchCriteria)
                  throws IlrObjectNotFoundException,
                         IlrRoleRestrictedPermissionException
Returns the list of elements matching the given search criteria.

Calling this method is equivalent to calling findElements(IlrSearchCriteria, IlrModelConstants.ELEMENT_DETAILS).

Throws:
IlrObjectNotFoundException - if some elements required to perform the search are missing. For example, the working baseline, or the project to be searched in the working baseline.
IlrRoleRestrictedPermissionException - if the working baseline is null and project elements are found when the current user is not an administrator.
Parameters:
searchCriteria - The search criteria.
Returns:
A list of IlrElementDetails.
See Also:
Code Example, findElements(IlrSearchCriteria, int)

findElements

List findElements(IlrSearchCriteria searchCriteria,
                  int returnedObjectFormat)
                  throws IlrObjectNotFoundException,
                         IlrRoleRestrictedPermissionException
Returns the elements stored in Decision Center that match the given search criteria.

If the working baseline is not null, the search is done using the working baseline. This method automatically takes into account the view permissions of the current user. For example, if the user does not have the rights to view decision tables and searches for all rules contained in the project, only rules that are not in decision tables are returned.

Throws:
IlrObjectNotFoundException - if some elements required to perform the search are missing. For example, the working baseline, or the project to be searched in the working baseline.
IlrRoleRestrictedPermissionException - if the working baseline is null and project elements are found when the current user is not an administrator.
Parameters:
searchCriteria - The search criteria.
returnedObjectFormat - Set the format of the returned objects to one of the following:
  • IlrModelConstants.ELEMENT_HANDLE
  • IlrModelConstants.ELEMENT_SUMMARY
  • IlrModelConstants.ELEMENT_DETAILS
Returns:
A list of the elements searched for in the format specified by returnedObjectFormat. The listed objects will be one of the following types:
  • IlrElementHandle
  • IlrElementSummary
  • IlrElementDetails
See Also:
Overview, Code Example, Project Security

findElementCommitableObjects

List<IlrCommitableObject> findElementCommitableObjects(IlrSearchCriteria searchCriteria)
                                                       throws IlrObjectNotFoundException,
                                                              IlrRoleRestrictedPermissionException
Same function as List findElements(IlrSearchCriteria searchCriteria, int returnedObjectFormat), returning IlrCommitableObject elements.

Throws:
IlrObjectNotFoundException
IlrRoleRestrictedPermissionException
Parameters:
searchCriteria -
Returns:
A list of the elements searched for, as IlrCommitableObject elements.

findElementDetails

List<IlrElementDetails> findElementDetails(IlrSearchCriteria searchCriteria)
                                           throws IlrObjectNotFoundException,
                                                  IlrRoleRestrictedPermissionException
Same function as List findElements(IlrSearchCriteria searchCriteria, int returnedObjectFormat), returning IlrElementDetails elements.

Throws:
IlrObjectNotFoundException
IlrRoleRestrictedPermissionException
Parameters:
searchCriteria -
Returns:
A list of the elements searched for, as IlrElementDetails elements.

findElementHandles

List<IlrElementHandle> findElementHandles(IlrSearchCriteria searchCriteria)
                                          throws IlrObjectNotFoundException,
                                                 IlrRoleRestrictedPermissionException
Same function as List findElements(IlrSearchCriteria searchCriteria, int returnedObjectFormat), returning IlrElementHandle elements.

Throws:
IlrObjectNotFoundException
IlrRoleRestrictedPermissionException
Parameters:
searchCriteria -
Returns:
A list of the elements searched for, as IlrElementHandle elements.

executeQuery

int executeQuery(IlrSearchCriteria searchCriteria)
                 throws IlrApplicationException
Finds the elements matching the given search criteria and executes the action defined in the query.

The Do part of the following query is an example of a search on an action part of a rule:

 Find all business rules such that ...
 Do
   set the status of 'each business rule' to new
 
When the query is run, the action part is executed for each element found by the search criteria. If there is a failure when applying the actions, an exception is thrown and the whole transaction is rolled back such that no changes are made to any element.

Throws:
IlrApplicationException - if an error occurs during the query execution. In this case, any change that could have been made to the elements before the exception was thrown are rolled back. and the remaining actions are canceled.
Parameters:
searchCriteria - The search criteria.
Returns:
The number of objects processed by the query.
See Also:
Overview, Code Example

getPossibleValues

List getPossibleValues(IlrElementHandle element,
                       org.eclipse.emf.ecore.EStructuralFeature feature)
                       throws IlrObjectNotFoundException
Returns the possible values for the given element and feature.

This method is typically called inside a GUI in order to display the items of an enumerated feature. It calls the IlrSessionController.getPossibleValues(ilog.rules.teamserver.model.IlrElementHandle, org.eclipse.emf.ecore.EStructuralFeature) method, which by default lists the items of the EEnum type of the feature.

Throws:
IlrObjectNotFoundException - if element cannot be found.
Parameters:
element - The current element.
feature - The enumerated feature. This parameter must be an EEnum instance.
Returns:
The list of objects of the Java type of feature.
See Also:
Overview, Code Example

getElementDetails

IlrElementDetails getElementDetails(IlrElementHandle handle)
                                    throws IlrObjectNotFoundException
Returns the details for the element in Decision Center that corresponds to the given handle.

Throws:
IlrObjectNotFoundException - if handle cannot be found in the database.
Parameters:
handle - The handle on the element whose details are needed.
Returns:
The details corresponding to handle according to the following cases:
  • If handle is a project element, the IlrElementDetails instance returned correspond to the version of the element referenced in the working baseline.
  • If the handle is not a project element, the IlrElementDetails instance returned correspond to the exact version of handle.
See Also:
Code Example, Overview

getElementSummary

IlrElementSummary getElementSummary(IlrElementHandle handle)
                                    throws IlrObjectNotFoundException
Returns the summary for the given element handle.

Throws:
IlrObjectNotFoundException - if handle cannot be found in the database.
Parameters:
handle - Handle on the element.
Returns:
The element summary.
See Also:
Code Example, Overview

getElementSummaryForThisHandle

IlrElementSummary getElementSummaryForThisHandle(IlrElementHandle handle)
                                                 throws IlrObjectNotFoundException
Returns the summary that correspond to the exact version of the given element handle.

Throws:
IlrObjectNotFoundException - if handle cannot be found in the database.
Parameters:
handle - Handle on the element.
Returns:
The element summary.
See Also:
Code Example, Overview

getElementsFromReference

List getElementsFromReference(IlrElementHandle handle,
                              org.eclipse.emf.ecore.EReference reference,
                              int returnedObjectFormat)
                              throws IlrObjectNotFoundException
Returns the value of the reference for the given element.

Throws:
IlrObjectNotFoundException - if the given element cannot be found in the database, or if some of the returned values cannot be found before the end of the transaction.
Parameters:
handle - The element handle.
reference - The EMF reference.
returnedObjectFormat - The format of the objects to be returned. This can be one of the following:
  • IlrModelConstants.ELEMENT_HANDLE
  • IlrModelConstants.ELEMENT_SUMMARY
  • IlrModelConstants.ELEMENT_DETAILS
Returns:
A list of elements handles, summaries, or details, depending on the value of returnedObjectFormat.
See Also:
Code Example, Overview

getElementsFromReference

List getElementsFromReference(IlrElementHandle handle,
                              org.eclipse.emf.ecore.EReference reference,
                              int returnedObjectFormat,
                              org.eclipse.emf.ecore.EStructuralFeature orderBy)
                              throws IlrObjectNotFoundException
Returns the value of the reference for the given element.

Throws:
IlrObjectNotFoundException - if the given element cannot be found in the database, or if some of the returned values cannot be found before the end of the transaction.
Parameters:
handle - The element handle.
reference - The EMF reference.
returnedObjectFormat - The format of the objects to be returned. This can be one of the following:
  • IlrModelConstants.ELEMENT_HANDLE
  • IlrModelConstants.ELEMENT_SUMMARY
  • IlrModelConstants.ELEMENT_DETAILS
orderBy - The order in which the search results are sorted.
Returns:
A list of elements handles, summaries, or details, depending on the value of returnedObjectFormat.
See Also:
Code Example, Overview

getElementSummary

IlrElementSummary getElementSummary(IlrElementHandle handle,
                                    IlrElementVersion version)
                                    throws IlrObjectNotFoundException
Returns the summary of the given element for the given version of the element.

Throws:
IlrObjectNotFoundException
Parameters:
handle - Handle on the element.
version - Version of the element.
Returns:
The summary for the version of element.
See Also:
getElementSummary(IlrElementHandle), Code Example, Overview

getElementDetails

IlrElementDetails getElementDetails(IlrElementHandle handle,
                                    IlrElementVersion version)
                                    throws IlrObjectNotFoundException
Returns the details of the given element for the given version of the element.

Throws:
IlrObjectNotFoundException
Parameters:
handle - The element handle.
version - The version of the element.
Returns:
The details of the version of the element.
See Also:
getElementDetails(IlrElementHandle), getElementSummary(IlrElementHandle, IlrElementVersion), Code Example, Overview

getHierarchyPath

String[] getHierarchyPath(IlrElementHandle handle)
                          throws IlrObjectNotFoundException
Returns the hierarchy path of a rule package, that is, a folder.

Throws:
IlrObjectNotFoundException
Parameters:
handle - The handle of a folder.
Returns:
An array containing the hierarchy path of the rule package.
See Also:
Code Example, Overview

getElementsFromReference

List getElementsFromReference(IlrElementHandle handle,
                              org.eclipse.emf.ecore.EReference reference,
                              IlrElementVersion version,
                              int returnedObjectFormat)
                              throws IlrObjectNotFoundException
Returns the value of the given reference for the given version of the given element.

Throws:
IlrObjectNotFoundException - if the given element cannot be found in the database, or if some of the values cannot be found before the end of the transaction.
Parameters:
handle - The element handle.
reference - The EMF reference.
version - The version of the element.
returnedObjectFormat - The format of the objects to be returned. This can be one of the following:
  • IlrModelConstants.ELEMENT_HANDLE
  • IlrModelConstants.ELEMENT_SUMMARY
  • IlrModelConstants.ELEMENT_DETAILS
Returns:
A list of element handles, summaries, or details, depending on the value of returnedObjectFormat.
See Also:
getElementsFromReference(IlrElementHandle, org.eclipse.emf.ecore.EReference, int), Code Example, Overview

getElementDetailsInWorkingBaseline

IlrElementDetails getElementDetailsInWorkingBaseline(IlrElementHandle handle)
                                                     throws IlrObjectNotFoundException
Returns the details of the given element in the working baseline.

Note: this method does not take the version id of handle into account. It looks for the element with the same original id in the working baseline.

Throws:
IlrObjectNotFoundException - if the element does not exist in the repository.
Parameters:
handle - The handle on the element whose details are needed. This element must be a brm.ProjectElement instance.
Returns:
The element details.
See Also:
Code Example, Overview

getElementDetailsForThisHandle

IlrElementDetails getElementDetailsForThisHandle(IlrElementHandle handle)
                                                 throws IlrObjectNotFoundException
Returns the details that correspond to the exact version of the given element handle.

Note: This method takes the version id of the handle into account, and not that of the working baseline.

Throws:
IlrObjectNotFoundException - if the element does not exist in the repository.
Parameters:
handle - The handle on the element whose details are needed.
Returns:
The details of the element.

createElement

IlrElementHandle createElement(org.eclipse.emf.ecore.EClass eclass)
Creates a handle for the given EMF class.

This does not commit anything to the database.

Parameters:
eclass - The EMF class of the element to be created.
Returns:
The element handle.

commit

IlrElementHandle commit(IlrCommitableObject cobject)
                        throws IlrApplicationException
Commits the given committable object with all its attached elements, to Decision Center.

This method commits any existing element details of cobject to Decision Center, as well as its attached items. The whole operation is done in a single transaction. If an error occurs during the commit, the transaction is rolled back.

   String documentation = "this is the doc";
   String name = "myNewPackage";
   final IlrBrmPackage brm = session.getBrmPackage();
   EClass rulePackageClass = brm.getRulePackage();
   IlrElementHandle packageHandle = session.createElement(rulePackageClass);
   IlrRulePackage myPackage = (IlrRulePackage)session.getElementDetails(packageHandle);
   myPackage.setDocumentation(documentation);
   myPackage.setName(name);
   myPackage.setRawValue(brm.getRulePackage_Parent(), null);
   IlrCommitableObject co = new IlrCommitableObject(myPackage);
   co.setRootDetails(myPackage);
   session.commit(co);
 

Throws:
IlrObjectNotFoundException - if cobject is not new but cannot be found in the database.
IlrInvalidElementException - if cobject is invalid. For example, if the name of a project element is null.
IlrObjectLockedException - if cobject already exists and is locked by another user.
IlrFolderLockedException - if the parent folder of cobject is recursively locked.
IlrPermissionException - if the user is not allowed to commit cobject.
IlrFrozenBaselineException - if the working baseline is not a branch
IlrActivityObjectLockedException
IlrApplicationException
Parameters:
cobject - The committable object to commit.
Returns:
The updated handle of the committed element. Once an object is committed, the original handle of cobject is no longer valid and you must use the updated handle.

commit

IlrElementHandle commit(IlrElementDetails details)
                        throws IlrApplicationException
Commits the given element details.

This is equivalent to calling commit(IlrCommitableObject) with a committable object whose root details are set with the given details.

Throws:
IlrObjectNotFoundException - if cobject is not new but cannot be found in the database.
IlrInvalidElementException - if cobject is invalid. For example, if the name of a project element is null.
IlrObjectLockedException - if cobject already exists and is locked by another user.
IlrFolderLockedException - if the parent folder of cobject is recursively locked.
IlrPermissionException - if the user is not allowed to commit cobject.
IlrFrozenBaselineException - if the working baseline is not a branch
IlrActivityObjectLockedException - if the object is locked by anothe Change Activity.
IlrApplicationException - if an operation triggered by the commit throws this exception.
Parameters:
details - The details to commit.
Returns:
The updated handle of the committed element. Once an object is committed, the original handle of cobject is no longer valid and you must use the updated handle.
See Also:
commit(IlrCommitableObject)

commit

List<IlrElementHandle> commit(List commitableObjects)
                              throws IlrApplicationException
Commits the given list of committable objects.

The whole operation is done in a single transaction. If an error occurs during the commit, the transaction is rolled back.

Throws:
IlrObjectNotFoundException - if cobject is not new but cannot be found in the database.
IlrInvalidElementException - if cobject is invalid. For example, if the name of a project element is null.
IlrObjectLockedException - if cobject already exists and is locked by another user.
IlrFolderLockedException - if the parent folder of cobject is recursively locked.
IlrPermissionException - if the user is not allowed to commit cobject.
IlrFrozenBaselineException - if the working baseline is not a branch
IlrActivityObjectLockedException
IlrApplicationException
Parameters:
commitableObjects - A list of IlrCommitableObject.
See Also:
commit(IlrCommitableObject)

getWorkingVocabulary

ilog.rules.vocabulary.model.IlrVocabularyManager getWorkingVocabulary()
Returns the vocabulary manager for the working baseline.

A vocabulary is the set of natural language terms and phrases attached to elements of a business object model and used for rule editing. The vocabularies set in the returned vocabulary are computed following the business object model path of the working baseline.

Returns:
The vocabulary manager for the working baseline.
See Also:
getWorkingBOM()

getWorkingBOM

ilog.rules.bom.IlrObjectModel getWorkingBOM()
Returns the Business Object Model (BOM) for the current baseline.

The BOM is a representation of the core concepts of a business and their logical connections. The BOM is the basis for the vocabulary used in business rules. The elements of a BOM map to those of a corresponding execution object model. The BOM is computed following the BOM path of the working baseline.

Returns:
The BOM for the working baseline.
See Also:
Code Example, Overview

getWorkingBaseline

IlrBaseline getWorkingBaseline()
Returns the working baseline.

See Also:
setWorkingBaseline(ilog.rules.teamserver.brm.IlrBaseline), Code Example, Overview

setWorkingBaseline

void setWorkingBaseline(IlrBaseline baseline)
                        throws IlrPermissionException,
                               IlrObjectNotFoundException
Sets the working baseline for this session.

When a working baseline is set, all the queries performed with this session will be filtered by baseline. For example, if you try to retrieve all the rules whose status is new by calling findElements(ilog.rules.teamserver.model.IlrSearchCriteria), the query will return all the rules whose status is new and that are used by baseline.

Throws:
IlrPermissionException - if the current user is not allowed to access the project attached to baseline. This may happen if security is enforced on the project and none of the groups the user belongs to are listed in the project groups.
IlrObjectNotFoundException - if baseline cannot be found in the database.
Parameters:
baseline - An instance of the EMF class brm.Baseline representing a baseline.
See Also:
getWorkingBaseline(), getWorkingBOM(), getWorkingVocabulary(), Code Example, Overview, Project Security

setUserLocale

void setUserLocale(Locale locale)
Sets the locale for the current user.

This locale is used in order to set the generated messages that this session may produce. For example, exceptions, and ruleset generation errors. By default, the locale is set to the locale of the Java Virtual Machine running your custom application.

Parameters:
locale - The user locale.

getUserLocale

Locale getUserLocale()
Returns The locale for the current user.

Returns:
The user locale.

getReferenceLocale

Locale getReferenceLocale()
Returns the reference locale.

The reference locale is the locale used to persist the rule artifacts in the database. When editing or viewing a rule in Decision Center, it converts the rule to the user's locale.

This locale is set either by:

Returns:
The reference locale for this session.

close

void close()
Closes the session.

Note: Always call this method when you have finished manipulating a user session. In particular, this method will remove the non-persistent locks that may have been set by the user.


isUserInRole

boolean isUserInRole(String role)
Indicates whether the user has the given role.

Parameters:
role - The role to test.
Returns:
true if the user has the given role.
See Also:
Project Security

getUserName

String getUserName()
Returns the name of the user connected with this session.

Returns:
The name of the current user.
See Also:
Overview

getLoginDate

Date getLoginDate()
Returns the date the user connected with this session logged into Decision Center.

Returns:
The login date.
See Also:
Overview

getAccessibleProjects

List<IlrRuleProject> getAccessibleProjects()
                                           throws IlrObjectNotFoundException
Returns the projects that can be accessed by the current user for this session.

A project can be accessed by a user if:

Throws:
IlrObjectNotFoundException - if one of the details of one of the accessible projects cannot be found
Returns:
A list of IlrRuleProject objects.
See Also:
Project Security

getAccessibleBaselines

List<IlrBaseline> getAccessibleBaselines(IlrElementHandle ruleProjectHandle)
                                         throws IlrObjectNotFoundException
Returns the baselines for given rule project that can be accessed by the current user for this session.

A branch can be accessed by a user if:

Then baselines can be accessed if they are created in a branch that the user can access. The list is sorted according to the baseline names.

Throws:
IlrObjectNotFoundException - if one of the details of one of the accessible baselines cannot be found.
Parameters:
ruleProjectHandle - The handle of the project for which we search accessible baselines.
Returns:
A list of IlrBaseline objects.

getAccessibleChildrenBaselines

List<IlrBaseline> getAccessibleChildrenBaselines(IlrBaseline parentBaseline)
                                                 throws IlrObjectNotFoundException
Returns the baselines that are children of the one given as a parameter and that can be accessed by the current user for this session. This is the same function as above, but it returns only baselines that are direct children of the one given in parameter.

Throws:
IlrObjectNotFoundException
Parameters:
parentBaseline -
Returns:
The list of direct children baselines that can be accessed by this session.

stringToElementHandle

IlrElementHandle stringToElementHandle(String idString)
Returns the element handle corresponding to the given string.

Parameters:
idString - A string representing the element, produced by the elementHandleToString method.
Returns:
The handle on the element to be retrieved.
See Also:
elementHandleToString(IlrElementHandle)

elementHandleToString

String elementHandleToString(IlrElementHandle element)
Returns a string serialization of the given element.

Parameters:
element - The element handle.
Returns:
A String that represents the handle.
See Also:
stringToElementHandle(String)

deleteElement

void deleteElement(IlrElementHandle element)
                   throws IlrApplicationException
Deletes the given element from the working project.

Throws:
IlrCannotDeleteException - if the object cannot be deleted because it is referenced by another object. For example, if the element is a rule package and contains subpackages or some rules.
IlrObjectLockedException - if the element is locked by another user.
IlrObjectNotFoundException - if the object to be deleted no longer exists in the repository.
IlrPermissionException - if the current user does not have the rights to delete the element.
IlrFrozenBaselineException - TODO
IlrFolderLockedException - TODO
IlrKnownUUIDException - TODO
IlrActivityObjectLockedException
IlrApplicationException
Parameters:
element - The handle on the element to be deleted.
See Also:
Project Security, Versions and Baselines

deleteElement

void deleteElement(IlrElementHandle element,
                   boolean recursive)
                   throws IlrApplicationException
Deletes the given element from the working project recursively on request.

If the element to delete is a rule package and the recursive parameter is set to true, the content of the folder will be deleted recursively.

This operation is executed in a transaction. If an exception is thrown while an element is being deleted, the whole operation is rolled back. For example, this would happen if a rule contained in a package to be deleted is locked.

Throws:
IlrCannotDeleteException - if the object cannot be deleted because it is referenced by another object. For example, the exception is if you try to delete a rule R1 that is overridden by a rule R2.
IlrObjectLockedException - if the element is locked by another user.
IlrObjectNotFoundException - if the object to be deleted no longer exists in the repository.
IlrPermissionException - if the current user does not have the rights to delete element.
IlrFrozenBaselineException - TODO
IlrFolderLockedException - TODO
IlrKnownUUIDException - TODO
IlrActivityObjectLockedException
IlrApplicationException
Parameters:
element - The handle on the element to be deleted.
recursive - Set to true to delete a rule package and all its contents.
See Also:
Project Security, Versions and Baselines

deleteElements

void deleteElements(List<? extends IlrElementHandle> elements,
                    boolean recursive)
                    throws IlrApplicationException
Deletes the given list of elements from the working project recursively, if requested.

If one of the elements to be deleted is a rule package and the recursive parameter is set to true, the content of the folder will be deleted recursively.

Throws:
IlrCannotDeleteException - if the object cannot be deleted because it is referenced by another object. For example, this exception is thrown if you try to delete a rule R1 that is overridden by a rule R2.
IlrObjectLockedException - if the element is locked by another user.
IlrObjectNotFoundException - If the object you try to delete does not exist in the repository.
IlrPermissionException - if you do not have the permissions to delete the element.
IlrFrozenBaselineException - TODO
IlrFolderLockedException - TODO
IlrKnownUUIDException - TODO
IlrActivityObjectLockedException
IlrApplicationException
Parameters:
elements - A list of IlrElementHandle objects.
recursive - Set to true to delete a rule package and all its contents.
See Also:
Project Security, Versions and Baselines

deleteElements

void deleteElements(List<? extends IlrElementHandle> elements)
                    throws IlrApplicationException
Deletes the given list of elements from the working project.

If one of the elements to delete is a rule package and contains some other elements, then an IlrCannotDeleteException is thrown.

Throws:
IlrCannotDeleteException - if the object cannot be deleted because it is referenced by another object. For example, this exception is thrown if you try to delete a rule R1 that is overridden by a rule R2.
IlrObjectLockedException - if the element is locked by another user.
IlrObjectNotFoundException - if the object you try to delete no longer exists in the repository.
IlrPermissionException - if you do not have the permissions to delete the element.
IlrFrozenBaselineException - TODO
IlrFolderLockedException - TODO
IlrKnownUUIDException - TODO
IlrActivityObjectLockedException
IlrApplicationException
Parameters:
elements - List of IlrElementHandle objects.
See Also:
Project Security, Versions and Baselines

restoreVersion

void restoreVersion(IlrElementHandle element,
                    IlrElementVersion elementVersion)
                    throws IlrApplicationException
Restores the given version of the given element.

Throws:
IlrPermissionException - if the element cannot be written because of the permissions.
IlrInvalidElementException - if the version to restore is invalid.
IlrObjectNotFoundException - if the given element cannot be found in the database.
IlrObjectLockedException - if the object to restore is already locked.
IlrFolderLockedException - if the folder in which the given element is contained is already locked.
IlrCannotRestoreDeleteVersionException - if the version cannot be restored
IlrActivityObjectLockedException
IlrApplicationException
ilog.rules.teamserver.model.IlrBaselineNotFoundException - if the working baseline is not set.
Parameters:
element - The handle on the element to be restored.
elementVersion - The version of the element to be restored.
See Also:
Versions and Baselines

getModelInfo

IlrModelInfo getModelInfo()
Returns the model info object describing the business rule model of Decision Center.

Returns:
The model info for Decision Center.

getElementVersion

IlrElementVersion getElementVersion(IlrElementHandle element,
                                    IlrElementHandle baseline)
                                    throws IlrObjectNotFoundException
Returns the version of the given element that is referenced by the given baseline.

Throws:
IlrObjectNotFoundException - if either element or baseline does not exist in the Decision Center repository.
Parameters:
element - The handle on the element for which you want to retrieve a specific version.
baseline - The baseline in which the required version of the element is referenced.
Returns:
The version of the element in the baseline.
See Also:
Versions and Baselines

getElementVersions

List<IlrElementVersion> getElementVersions(IlrElementHandle element)
                                           throws IlrObjectNotFoundException
Returns a list containing all versions of a given element stored in Decision Center.

Throws:
IlrObjectNotFoundException - TODO
Parameters:
element - The handle on the element for which you want to retrieve the versions.
Returns:
A list of IlrElementVersion objects.
See Also:
Versions and Baselines

getBrmPackage

IlrBrmPackage getBrmPackage()
Gets the EMF package containing the Decision Center classes and data types.

This is a shortcut to getModelInfo().getBrmPackage().

Returns:
An EMF EPackage.
See Also:
IlrModelInfo.getBrmPackage()

reloadDynamicDomains

boolean reloadDynamicDomains()
                             throws IlrApplicationException
Reloads all the dynamic domains present in the BOM.

A dynamic domain is a way of defining the set of possible values for a type. The set of values for a dynamic domain is stored and managed outside the business object model. Changes to the set of values are automatically reflected in the business object model.

Throws:
IlrApplicationException
Returns:
Returns true if some domains were updated.

getWorkingVariableProvider

ilog.rules.brl.brldf.IlrBRLVariableProvider getWorkingVariableProvider()
Returns the variable provider for the working baseline.

The variables in the returned variable provider gather the variables from the variable set of the project and its dependencies, plus the project parameters.

Since:
JRules 6.5
Returns:
The variable provider for the working baseline.

eraseProject

void eraseProject(IlrRuleProject ruleProject)
                  throws IlrCannotDeleteException,
                         IlrObjectNotFoundException,
                         IlrRoleRestrictedPermissionException,
                         IlrObjectLockedException,
                         IlrPermissionException
Erases a project from the database.

This will erase the project, its content, and all its history (artifact versions). The caller must have the role 'rtsAdministrator' to perform it.

Throws:
IlrCannotDeleteException - if the project cannot be deleted.
IlrObjectNotFoundException - if the project cannot be found in the repository.
IlrRoleRestrictedPermissionException - if the caller does not have "rtsAdministrator" as one of its roles.
IlrObjectLockedException - if an artifact is locked by another user.
IlrPermissionException - TODO
Parameters:
ruleProject - The rule project to be erased.
See Also:
Code Example, Rule Projects, Project Security

getElementVersion

IlrElementVersion getElementVersion(IlrElementHandle element)
Returns the version information corresponding to the given element.

The version is retrieved according to the version id contained in the given handle, as opposed to getElementVersion(IlrElementHandle, IlrElementHandle) which retrieves the version referenced in the given baseline.

Since:
JRules 6.5
Parameters:
element - The handle on the element for which we want to retrieve a version.
Returns:
The version of the element.

copyTo

List copyTo(List sourceElements,
            IlrElementDetails target,
            boolean recursive,
            String duplicatePrefix)
            throws IlrApplicationException
Copies a list of elements in a package.

Since:
JRules 6.6
Throws:
IlrApplicationException - if an error occurs during the copy, in which case the whole copy operation is canceled.
Parameters:
sourceElements - A list of IlrElementHandle objects to copy. These objects must belong to the working baseline, otherwise an IlrObjectNotFoundException will be thrown.
target - Either an instance of IlrRulePackage to designate the package in which the elements must be copied. The package can be from a baseline other than the working baseline, or an instance of IlrRuleProject if you want to copy the elements in the root package of the given project. If null, the elements will be copied to the root package of the working baseline.
recursive - If some source elements are rule packages, it indicates whether the copy must be recursive, that is, whether it must include all subpackages and package elements (rule artifacts, templates, and so on).
duplicatePrefix - Specifies the string to prepend to the name of each copied element in case an element with the same name already exists in the target package.
Returns:
A list of handles (IlrElementHandle) on the new copied objects.

copyTo

List copyTo(List sourceElements,
            IlrElementDetails target,
            IlrBaseline branch,
            boolean recursive,
            String duplicatePrefix)
            throws IlrApplicationException
Copies a list of elements in a package.

Since:
JRules 6.6
Throws:
IlrApplicationException - if an error occurs during the copy, in which case the whole copy operation is canceled.
Parameters:
sourceElements - A list of IlrElementHandle objects to copy. These objects must belong to the working baseline, otherwise an IlrObjectNotFoundException will be thrown.
target - Either an instance of IlrRulePackage to designate the package in which the elements must be copied. The package can be from a baseline other than the working baseline, or an instance of IlrRuleProject if you want to copy the elements in the root package of the given project. If null, the elements will be copied to the root package of the working baseline.
branch - The branch to use for the target.
recursive - If some source elements are rule packages, it indicates whether the copy must be recursive, that is, whether it must include all subpackages and package elements (rule artifacts, templates, and so on).
duplicatePrefix - Specifies the string to prepend to the name of each copied element in case an element with the same name already exists in the target package.
Returns:
A list of handles (IlrElementHandle) on the new copied objects.

copyTo

IlrElementHandle copyTo(IlrElementHandle sourceElement,
                        IlrElementVersion elementVersion,
                        IlrElementDetails target,
                        boolean recursive,
                        String duplicatePrefix)
                        throws IlrApplicationException
Copies an element or one of its versions in a package.

Since:
JRules 6.6
Throws:
IlrApplicationException - if an error occurs during the copy, in which case the whole copy operation is canceled.
Parameters:
sourceElement - The element to copy. It must belong to the working baseline, otherwise an IlrObjectNotFoundException will be thrown.
elementVersion - The version of the element to copy. If null, the version will be the one referenced in the current baseline.
target - Either an instance of IlrRulePackage to designate the package in which the elements must be copied, which can be from a baseline other than the working baseline, or an instance of IlrRuleProject if you want to copy the elements in the root package of the given project. If null, the elements will be copied to the root package of the working baseline.
recursive - If the source element is a rule package, indicates whether the copy must be recursive, that is, must include all subpackages and package elements (rule artifacts, templates, and so on).
duplicatePrefix - Specifies the string to prepend to the name of the copied element in case an element with the same name already exists in the target package.
Returns:
A handle on the new copied object.

copyTo

IlrElementHandle copyTo(IlrElementHandle sourceElement,
                        IlrElementVersion elementVersion,
                        IlrElementDetails target,
                        IlrBaseline branch,
                        boolean recursive,
                        String duplicatePrefix)
                        throws IlrApplicationException
Copies an element or one of its versions in a package.

Since:
JRules 6.6
Throws:
IlrApplicationException - if an error occurs during the copy, in which case the whole copy operation is canceled.
Parameters:
sourceElement - The element to copy. It must belong to the working baseline, otherwise an IlrObjectNotFoundException will be thrown.
elementVersion - The version of the element to copy. If null, the version will be the one referenced in the current baseline.
target - Either an instance of IlrRulePackage to designate the package in which the elements must be copied, which can be from a baseline other than the working baseline, or an instance of IlrRuleProject if you want to copy the elements in the root package of the given project. If null, the elements will be copied to the root package of the working baseline.
branch - The branch to use for the target.
recursive - If the source element is a rule package, indicates whether the copy must be recursive, that is, must include all subpackages and package elements (rule artifacts, templates, and so on).
duplicatePrefix - Specifies the string to prepend to the name of the copied element in case an element with the same name already exists in the target package.
Returns:
A handle on the new copied object.

setAttribute

void setAttribute(String name,
                  Object value)
Binds an object to this session, using the name specified. If an object of the same name is already bound to the session, it is replaced. A typical use of session attributes is to set some data on the session and to retrieve it server-side; for example, in an extractor validator (see IlrExtractorValidator), in order to select a rule at extraction time. NOTE: When an attribute is set on a remote session (such as IlrRemoteSession), the bound attributes are passed back and forth to the server for each call to an IlrSession method. Thus, setting large objects as session attributes may have an adverse effect on performance, since the attribute will be serialized, and sent to the server as an argument of an EJB method. For the same reason, we recommend that you remove an attribute as soon as you have finished with it.

Parameters:
name - The name to which the object is bound. It cannot be null.
value - The object to be bound. It must be serializable and cannot be null.

getAttribute

Object getAttribute(String name)
Returns the object bound with the specified name in this session. It returns null if no object is bound under the name.

Parameters:
name - A string specifying the name of the object.
Returns:
The object with the specified name.

removeAttribute

Object removeAttribute(String name)
Removes the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.

Parameters:
name - The name of the object to remove from this session.
Returns:
The object with the specified name.

getAttributeNames

Iterator<String> getAttributeNames()
Returns an Iterator of String objects containing the names of all the objects bound to this session.

Returns:
An Iterator of String objects specifying the names of all the objects bound to this session.

Decision Center API

© Copyright IBM Corp. 1987, 2013