Class IlrDefaultSearchCriteria
- java.lang.Object
-
- ilog.rules.teamserver.model.IlrDefaultSearchCriteria
-
- All Implemented Interfaces:
- IlrSearchCriteria, java.io.Serializable, java.lang.Cloneable
- Direct Known Subclasses:
- ilog.rules.teamserver.model.IlrSearchCriteriaWithNotEqualFeature
public class IlrDefaultSearchCriteria extends java.lang.Object implements IlrSearchCriteria, java.io.Serializable, java.lang.Cloneable
IlrDefaultSearchCriteria
is the default implementation ofIlrSearchCriteria
. It is used to specify the search criteria passed to thefindElements
search methods of anIlrSession
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 theIlrDefaultSearchCriteria
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 anIlrSession
instance for a specific user. You use the API to do the following:- Customize the Security and behavior of Decision Center to user interaction.
- Create and control rule projects and rules.
- Control the versions and baselines for files and projects.
-
-
Constructor Summary
Constructors Constructor and Description 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, java.util.List features, java.util.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, java.util.List features, java.util.List values, java.lang.String query, int scope, org.eclipse.emf.ecore.EStructuralFeature orderBy, boolean ascending)
Creates a fully customizable search criteria.IlrDefaultSearchCriteria(java.lang.String query)
Creates a search criterion that gets the elements matching the given query.
-
Method Summary
Methods Modifier and Type Method and Description java.lang.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.java.util.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 toIlrSession.findElements
with thisIlrSearchCritera
instance.java.lang.String
getQuery()
Gets the Business Query Language query that will be searched with whenIlrSession.findElements
is called.int
getScope()
Gets the scope of the search: that is, whether calls toIlrSession.findElements
with this object will search in the current project only or in the current project and its dependent projects.java.util.List
getValues()
Gets the list of the values to be searched for.boolean
isAscending()
Specifies whether the results of a call toIlrSession.findElements
with this object will be sorted in ascending or descending order.boolean
isOrderById()
boolean
isSystemLockSearchCriteria()
void
setEngineFallback(boolean mode)
To be used when a translation issue is known, and rule engine should be used to run the query.java.lang.String
toString()
void
unsetOrderById()
-
-
-
Constructor Detail
-
IlrDefaultSearchCriteria
public IlrDefaultSearchCriteria(org.eclipse.emf.ecore.EClass eclass, java.util.List features, java.util.List values, java.lang.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. Ifquery
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 bebrm.ActionRule
, orbrm.BusinessRule
. This parameter can be set tonull
if the query parameter is non-null
.features
- The list of features to search in. Set toCollections.EMPTY_LIST
if you do not want to filter the features to be searched in.values
- The list of values to search for. Set toCollections.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 totrue
so the search results are sorted in ascending order.- See Also:
- Overview, Code Example
-
IlrDefaultSearchCriteria
public IlrDefaultSearchCriteria(org.eclipse.emf.ecore.EClass eclass, java.util.List features, java.util.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 isSCOPE_PROJECT_AND_DEPENDENCIES
.- Parameters:
eclass
- The EMF class of the elements to search for. For example, set tobrm.ActionRule
to search for all the action rules in this project and its dependencies. This parameter cannot be set tonull
.features
- The list of features to search in. Set toCollections.EMPTY_LIST
if you do not want to filter the feature to be searched in.values
- The list of values to search for. Set toCollections.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 isSCOPE_PROJECT_AND_DEPENDENCIES
.- Parameters:
eclass
- The EMF class of the elements to search. For example, set tobrm.ActionRule
to search for all the action rules in this project and its dependencies. This parameter cannot be set tonull
.- See Also:
- Overview,
Code Example,
IlrDefaultSearchCriteria(EClass, List, List, String, int, EStructuralFeature, boolean)
-
IlrDefaultSearchCriteria
public IlrDefaultSearchCriteria(java.lang.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 java.lang.String getQuery()
Description copied from interface:IlrSearchCriteria
Gets the Business Query Language query that will be searched with whenIlrSession.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 interfaceIlrSearchCriteria
- 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 toIlrSession.findElements
with this object will search in the current project only or in the current project and its dependent projects.- Specified by:
getScope
in interfaceIlrSearchCriteria
- Returns:
- One of the following:
- See Also:
- Overview,
IlrSession
,IlrDefaultSearchCriteria
-
getFeatures
public java.util.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 interfaceIlrSearchCriteria
- 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 java.util.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 interfaceIlrSearchCriteria
- Returns:
- The list of
org.eclipse.emf.ecore.EStructuralFeature
objects that will be searched for whenIlrSession.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 toIlrSession.findElements
with thisIlrSearchCritera
instance.- Specified by:
getOrderBy
in interfaceIlrSearchCriteria
- 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 toIlrSession.findElements
with this object will be sorted in ascending or descending order.- Specified by:
isAscending
in interfaceIlrSearchCriteria
- Returns:
True
If the results of the search will be sorted in ascending order.- See Also:
- Overview,
Custom search example,
IlrSession
,IlrDefaultSearchCriteria
-
setEngineFallback
public void setEngineFallback(boolean mode)
To be used when a translation issue is known, and rule engine should be used to run the query.
-
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 ..."
brm.ActionRule
, orbrm.BusinessRule
.- Specified by:
getEClass
in interfaceIlrSearchCriteria
- Returns:
- An EMF class.
- See Also:
- Overview,
IlrDefaultSearchCriteria
-
clone
public java.lang.Object clone()
Description copied from interface:IlrSearchCriteria
Returns a copy of this search criteria instance.- Specified by:
clone
in interfaceIlrSearchCriteria
- Overrides:
clone
in classjava.lang.Object
- Returns:
- A copy of this search criteria instance.
- See Also:
- Overview
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isSystemLockSearchCriteria
public boolean isSystemLockSearchCriteria()
-
-