public interface IlrQueryService extends IlrRuleProjectService, ilog.rules.brl.bql.IlrQueryEnvironment, ilog.rules.brl.bql.IlrQueryParsingService
Sample use:
IlrQueryService queryService = (IlrQueryServiceImpl) IlrStudioQueryPlugin.getQueryService(ruleProject); IlrQuery myQuery = ...; queryService.initQuery(myQuery, null); List results = queryService.runQuery();If a query has actions (for example, "Find all rules such that... Do copy each rule to package pack1"), these actions must be run seperately, once the query has been run and the elements matching it have been returned:
if (queryService.queryHasActions()) {
queryService.runQueryActions(results);
}
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
SERVICE_ID |
| Modifier and Type | Method and Description |
|---|---|
java.util.Locale |
getQueryLocale(ilog.rules.brl.bql.model.IlrQueryElement query)
Returns the locale of the given query, or a fallback locale if it's null.
|
void |
initializeQuery(IlrQuery query,
IlrRuleQueryMatchCollector mc)
Initializes a query before it can be run.
|
void |
initQuery(IlrQuery query,
IlrRuleQueryMatchCollector mc)
Deprecated.
|
void |
initQuery(IlrRuleProject queryProject,
boolean queryIncludeDependencies,
java.util.Locale queryLocale,
java.lang.String queryText,
IlrRuleQueryMatchCollector mc)
Initializes a query before it can be run.
|
boolean |
queryHasActions()
Returns information on whether the query that has initialized the service has actions or not.
|
java.util.List |
runQuery()
Runs the query which the service has been initialized with, and returns the result in a list.
|
void |
runQueryActions(java.util.List queryResult)
Runs the query actions (if any) on a list of results.
|
dispose, getRuleProject, getServiceID, initialize, setRuleProject, setServiceIDstatic final java.lang.String SERVICE_ID
void initQuery(IlrRuleProject queryProject, boolean queryIncludeDependencies, java.util.Locale queryLocale, java.lang.String queryText, IlrRuleQueryMatchCollector mc) throws IlrSyntaxError, java.io.IOException
java.io.IOExceptionIlrSyntaxErrorqueryProject - the RuleProject on which this query is supposed to runqueryIncludeDependencies - true if project dependencies must be followedqueryLocale - the locale of the queryqueryText - the text of the query (e.g. "Find all rules such that...")mc - the collector in which the query results will be stored. Passing null means this IlrQueryServiceImpl will be used as collector.@Deprecated void initQuery(IlrQuery query, IlrRuleQueryMatchCollector mc) throws java.io.IOException, IlrSyntaxError, org.eclipse.core.runtime.CoreException
initializeQuery(IlrQuery, IlrRuleQueryMatchCollector) instead
java.io.IOExceptionIlrSyntaxErrororg.eclipse.core.runtime.CoreExceptionquery - The IlrQuery which condition will be used (@see IlrQuery#getCondition).mc - The collector in which the query results will be stored.void initializeQuery(IlrQuery query, IlrRuleQueryMatchCollector mc) throws IlrQueryException
IlrQueryExceptionquery - The IlrQuery which condition will be used (@see IlrQuery#getCondition).mc - The collector in which the query results will be stored.java.util.List runQuery()
The list is built by the #IlrRuleQueryMatchCollector object which was used to initialize the service. If the query was on #IlrProjectElement objects, the list will contain #IlrQueryProjectElementWrapper objects.
IlrQueryProjectElementWrapperboolean queryHasActions()
For example, if the query is of the form "Find all elements such that <condition> Do <actions>" or simply "Find all elements such that <condition>".
void runQueryActions(java.util.List queryResult)
throws java.io.FileNotFoundException
The list will typically be the one returned by #runQuery().
java.io.FileNotFoundException - if a query action such as 'copy to package' or 'move to package' fails because it was specified
a package which doesn't exist.java.util.Locale getQueryLocale(ilog.rules.brl.bql.model.IlrQueryElement query)
© Copyright IBM Corp. 1987, 2017