Decision Center API

ilog.rules.teamserver.model
Class IlrDefaultSearchCriteria

java.lang.Object
  extended by ilog.rules.teamserver.model.IlrDefaultSearchCriteria
All Implemented Interfaces:
IlrSearchCriteria, Serializable, Cloneable

public class IlrDefaultSearchCriteria
extends Object
implements IlrSearchCriteria, Serializable, Cloneable

IlrDefaultSearchCriteria is the default implementation of IlrSearchCriteria. It is used to specify the search criteria passed to the findElements search methods of an IlrSession object.

Overview

The simplest possible search criteria instance contains a search string only. For example:

 IlrSearchCriteria criteria = new IlrDefaultSearchCriteria(
   "Find all business rules");
 
More complex search criteria are defined when you call the IlrDefaultSearchCriteria constructor. See the
search overview for a list of the customizable search criteria.

Example

The following code example shows how to create a complex IlrDefaultSearchCriteria instance using information from an existing rule project:

   IlrRulePackage parent = null;
   // Get the EMF package containing the Decision Center classes and data types
   IlrBrmPackage brm = session.getBrmPackage();
   // Get the PARENT PACKAGE attribute
   EStructuralFeature feature = brm.getRulePackage_Parent();
   // Build the search criteria parameter
   List properties = new ArrayList();
   List values = new ArrayList();
   properties.add(feature);
   values.add(parent);
   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");
   // Set the features, values, query, scope, and search order
   IlrDefaultSearchCriteria searchCriteria = new IlrDefaultSearchCriteria(
     brm.getRulePackage(), properties, values, query,
     IlrModelConstants.SCOPE_PROJECT_AND_DEPENDENCIES, null, false);
   //   Execute the Query
   List elements = session.findElements(searchCriteria);
   System.out.println("No of elements is:" + elements.size());
   for (int i = 0; i < elements.size(); i++) {
     IlrElementSummary ruleSummary = (IlrElementSummary) elements.get(i);
     String ruleName = ruleSummary.getName();
     System.out.println("\t" + ruleName);
   }
 

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.findElements(IlrSearchCriteria, int), IlrSession.findElements(IlrSearchCriteria), IlrModelConstants, Serialized Form

Constructor Summary
IlrDefaultSearchCriteria(org.eclipse.emf.ecore.EClass eclass)
          Creates a search criterion that will be used to retrieve the elements of a given class in the current project.
IlrDefaultSearchCriteria(org.eclipse.emf.ecore.EClass eclass, List features, List values)
          Creates a search criterion that will be used to retrieve specific values from a list of features chosen from elements of a specific class stored in Decision Center.
IlrDefaultSearchCriteria(org.eclipse.emf.ecore.EClass eclass, List features, List values, String query, int scope, org.eclipse.emf.ecore.EStructuralFeature orderBy, boolean ascending)
          Creates a fully customizable search criteria.
IlrDefaultSearchCriteria(String query)
          Creates a search criterion that gets the elements matching the given query.
 
Method Summary
 Object clone()
          Returns a copy of this search criteria instance.
 org.eclipse.emf.ecore.EClass getEClass()
          Gets an EMF class of the elements to be searched for.
 List getFeatures()
          Gets the list of features to be searched for.
 org.eclipse.emf.ecore.EStructuralFeature getOrderBy()
          Gets the object that will be used to sort the results of a call to IlrSession.findElements with this IlrSearchCritera instance.
 String getQuery()
          Gets the Business Query Language query that will be searched with when IlrSession.findElements is called.
 int getScope()
          Gets the scope of the search: that is, whether calls to IlrSession.findElements with this object will search in the current project only or in the current project and its dependent projects.
 List getValues()
          Gets the list of the values to be searched for.
 boolean isAscending()
          Specifies whether the results of a call to IlrSession.findElements with this object will be sorted in ascending or descending order.
 boolean isOrderById()
           
 String toString()
           
 void unsetOrderById()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlrDefaultSearchCriteria

public IlrDefaultSearchCriteria(org.eclipse.emf.ecore.EClass eclass,
                                List features,
                                List values,
                                String query,
                                int scope,
                                org.eclipse.emf.ecore.EStructuralFeature orderBy,
                                boolean ascending)
Creates a fully customizable search criteria.

Parameters:
eclass - The EMF class of the searched elements. If query is set, this must be a super class of the query's EMF class. For example, if the query is "for each action rule such that ...", the EMF class must be brm.ActionRule, or brm.BusinessRule. This parameter can be set to null if the query parameter is non-null.
features - The list of features to search in. Set to Collections.EMPTY_LIST if you do not want to filter the features to be searched in.
values - The list of values to search for. Set to Collections.EMPTY_LIST if no value is provided.
query - A query string written in Business Query Language. For example: "find all business rules such that the name of each business rule starts with 'loan'").
scope - The scope of the search: that is, if the search occurs in the current project only or includes dependent projects. Use one of the following values:
orderBy - The order in which the search results are sorted.
ascending - Set to true so the search results are sorted in ascending order.
See Also:
Overview, Code Example

IlrDefaultSearchCriteria

public IlrDefaultSearchCriteria(org.eclipse.emf.ecore.EClass eclass,
                                List features,
                                List values)
Creates a search criterion that will be used to retrieve specific values from a list of features chosen from elements of a specific class stored in Decision Center.

Calling this constructor is the equivalent of calling the following:

   IlrDefaultSearchCriteria(
     eclass,
     features,
     values,
     null,
     IlrModelConstants.DEFAULT_SCOPE,
     null,
     true)
 
The default scope is SCOPE_PROJECT_AND_DEPENDENCIES.

Parameters:
eclass - The EMF class of the elements to search for. For example, set to brm.ActionRule to search for all the action rules in this project and its dependencies. This parameter cannot be set to null.
features - The list of features to search in. Set to Collections.EMPTY_LIST if you do not want to filter the feature to be searched in.
values - The list of values to search for. Set to Collections.EMPTY_LIST if no value is provided.
See Also:
Overview, Code Example, IlrDefaultSearchCriteria(EClass, List, List, String, int, EStructuralFeature, boolean)

IlrDefaultSearchCriteria

public IlrDefaultSearchCriteria(org.eclipse.emf.ecore.EClass eclass)
Creates a search criterion that will be used to retrieve the elements of a given class in the current project.

Calling this constructor is the equivalent of calling the following:

   IlrDefaultSearchCriteria(
     eclass,
     Collections.EMPTY_LIST,
     Collections.EMPTY_LIST,
     null,
     IlrModelConstants.DEFAULT_SCOPE,
     null,
     true)
 
The default scope is SCOPE_PROJECT_AND_DEPENDENCIES.

Parameters:
eclass - The EMF class of the elements to search. For example, set to brm.ActionRule to search for all the action rules in this project and its dependencies. This parameter cannot be set to null.
See Also:
Overview, Code Example, IlrDefaultSearchCriteria(EClass, List, List, String, int, EStructuralFeature, boolean)

IlrDefaultSearchCriteria

public IlrDefaultSearchCriteria(String query)
Creates a search criterion that gets the elements matching the given query.

Calling this constructor is the equivalent of calling the following:

   IlrDefaultSearchCriteria(
     null,
     Collections.EMPTY_LIST,
     Collections.EMPTY_LIST,
     query,
     IlrModelConstants.DEFAULT_SCOPE,
     null,
     true);
 
 The default scope is
 SCOPE_PROJECT_AND_DEPENDENCIES.

Parameters:
query - A query string written in Business Query Language. For example: "find all business rules such that the name of each business rule starts with 'loan'").
See Also:
Overview, Code Example, IlrDefaultSearchCriteria(EClass, List, List, String, int, EStructuralFeature, boolean)
Method Detail

getQuery

public String getQuery()
Description copied from interface: IlrSearchCriteria
Gets the Business Query Language query that will be searched with when IlrSession.findElements is called.

If features and values are set in this object, calls to IlrSession.findElements with this object will return the elements that match the features, values and query in this search criteria instance.

Specified by:
getQuery in interface IlrSearchCriteria
Returns:
A text query. If no query was defined in this object, null is returned.
See Also:
Overview, IlrSession, Custom search example, IlrDefaultSearchCriteria

getScope

public int getScope()
Description copied from interface: IlrSearchCriteria
Gets the scope of the search: that is, whether calls to IlrSession.findElements with this object will search in the current project only or in the current project and its dependent projects.

Specified by:
getScope in interface IlrSearchCriteria
Returns:
One of the following:
See Also:
Overview, IlrSession, IlrDefaultSearchCriteria

getFeatures

public List getFeatures()
Description copied from interface: IlrSearchCriteria
Gets the list of features to be searched for.

If a Business Query Language query is set in this object, calls to IlrSession.findElements with this object will return the elements that match the features, values and query in this search criteria instance.

Note: This list of features must have a corresponding list of values.

Specified by:
getFeatures in interface IlrSearchCriteria
Returns:
The list of org.eclipse.emf.ecore.EStructuralFeature objects that will be searched for. If no features were defined, null is returned.
See Also:
Overview, IlrSearchCriteria.getValues(), IlrSession, Custom search example, IlrDefaultSearchCriteria

getValues

public List getValues()
Description copied from interface: IlrSearchCriteria
Gets the list of the values to be searched for.

If a Business Query Language query is set in this object, calls to IlrSession.findElements with this object will return the elements that match the features, values and query in this search criteria instance.

Note: This list of values must have a corresponding list of features.

Specified by:
getValues in interface IlrSearchCriteria
Returns:
The list of org.eclipse.emf.ecore.EStructuralFeature objects that will be searched for when IlrSession.findElements is called. If no values were defined, null is returned.
See Also:
Overview, IlrSearchCriteria.getFeatures(), IlrSession, Custom search example, IlrDefaultSearchCriteria

getOrderBy

public org.eclipse.emf.ecore.EStructuralFeature getOrderBy()
Description copied from interface: IlrSearchCriteria
Gets the object that will be used to sort the results of a call to IlrSession.findElements with this IlrSearchCritera instance.

Specified by:
getOrderBy in interface IlrSearchCriteria
Returns:
An EMF feature. If no sort was defined in this object, null is returned.
See Also:
Overview, IlrSession, IlrDefaultSearchCriteria

unsetOrderById

public void unsetOrderById()

isOrderById

public boolean isOrderById()

isAscending

public boolean isAscending()
Description copied from interface: IlrSearchCriteria
Specifies whether the results of a call to IlrSession.findElements with this object will be sorted in ascending or descending order.

Specified by:
isAscending in interface IlrSearchCriteria
Returns:
True If the results of the search will be sorted in ascending order.
See Also:
Overview, Custom search example, IlrSession, IlrDefaultSearchCriteria

getEClass

public org.eclipse.emf.ecore.EClass getEClass()
Description copied from interface: IlrSearchCriteria
Gets an EMF class of the elements to be searched for.

If a query is set, the value returned must be a super class of the query's EMF class. For example, if the query is:

"for each action rule such that ..."

the EMF class must be brm.ActionRule, or brm.BusinessRule.

Specified by:
getEClass in interface IlrSearchCriteria
Returns:
An EMF class.
See Also:
Overview, IlrDefaultSearchCriteria

clone

public Object clone()
Description copied from interface: IlrSearchCriteria
Returns a copy of this search criteria instance.

Specified by:
clone in interface IlrSearchCriteria
Overrides:
clone in class Object
Returns:
A copy of this search criteria instance.
See Also:
Overview

toString

public String toString()
Overrides:
toString in class Object

Decision Center API

© Copyright IBM Corp. 1987, 2013