|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.rule.util.QueryUtils
This class provides query utility methods that are used by classes in the
wt.rule
package.
Field Summary | |
private static String |
RESOURCE
|
Constructor Summary | |
QueryUtils()
|
Method Summary | |
static QuerySpec |
createBasicQuerySpec(Class table,
RuleType ruleType,
boolean defaultRule,
boolean enabled)
Construct a basic QuerySpec that can be used
as the basis for querying for Rule s: either
InstanceBasedRule s or TypeBasedRule s
(or another Rule subclass). |
static WTContainerRef[] |
getAncestorArray(WTContainerRef container)
Return an array of WTContainerRef s that
includes the specified container plus all of its ancestors. |
(package private) static QuerySpec |
getBasicSpec(RuleType ruleType,
Boolean defaultRule,
Boolean enabled)
Return a QuerySpec that queries the
TypeBasedRule table for rules that meet the specified
criteria. |
static Rule[] |
getRules(RuleType ruleType,
Boolean defaultRule,
Boolean enabled,
WTContainerRef[] containers,
String[] typeNames,
boolean first_match)
Return all TypeBasedRule s that meet the specified
criteria. |
(package private) static StatementSpec |
getTypeHierarchySpec(QuerySpec qs,
String[] typeNames)
Return a StatementSpec that returns the IDs of all
TypeBasedRule s that meet the conditions in the query
spec that is passed in and have their OBJ_TYPE attribute
set equal to one of the type names in the typeNames list. |
private static StatementSpec |
getTypeHierarchySpec(QuerySpec qs,
WTContainerRef[] containers,
String[] typeNames)
Return a StatementSpec that returns the IDs of all
TypeBasedRule s that meet the conditions in the query
spec that is passed in and are contained in one of the containers in
the containers list and have their OBJ_TYPE
attribute set equal to one of the typenames in the typeNames
list. |
static String[] |
getTypeNames(Class type)
Return an array of type names that includes the name of the specified type plus the names of all of its parent types. |
(package private) static WhereExpression |
getWhereTypeIs(String typeName)
Returns a WhereExpression that can be used to filter
a query for TypeBasedRule s to only return rules whose
OBJ_TYPE attribute is equal to the specified type name. |
(package private) static WTArrayList |
inflateIDs(QueryResult ids,
boolean first_match)
Used to expand the results of a query that has only selected the IDs of the objects. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String RESOURCE
Constructor Detail |
public QueryUtils()
Method Detail |
public static Rule[] getRules(RuleType ruleType, Boolean defaultRule, Boolean enabled, WTContainerRef[] containers, String[] typeNames, boolean first_match) throws WTException
TypeBasedRule
s that meet the specified
criteria.
If any parameter is null then that parameter is not used to filter the results.
Rules that are contained in one of the containers specified in the
containers
list are returned. Rules whose OBJ_TYPE
attribute is equal to one of the type names listed in the
typeNames
list are returned.
The results are ordered to be consistent with the order of the containers
in the containers
list. All rules that are contained in the
first container in the containers
list are first in the result
set, followed by the rules that are contained in the second container in the
containers
list, and so on. Rules that belong to the same
container are ordered to be consistent with the order of the type names in the
typeNames
list. All rules whose OBJ_TYPE
attribute is
equal to the first type name in the list are first in the result set, followed
by the rules whose OBJ_TYPE
attribute is equal to the second type
name in the list, and so on.
If first_match
is true then the rule that would be first in
the result set is returned. This is the rule that meets the basic search
criteria (ruleType
, defaultRule
and enabled
),
is contained in the container closest to the front of the containers
list and whose OBJ_TYPE
is closest to the front of the
typeNames
list.
ruleType
- the rule type to filter the results ondefaultRule
- the defaultRule value to filter the results onenabled
- the enabled value to filter the results oncontainers
- the containers to search intypeNames
- the type names to search forfirst_match
- whether only the first result object should be returned
WTException
wt.inf.container.StandardWTContainerService#orderedQuery
static WhereExpression getWhereTypeIs(String typeName) throws QueryException
WhereExpression
that can be used to filter
a query for TypeBasedRule
s to only return rules whose
OBJ_TYPE
attribute is equal to the specified type name.
typeName
- the name of the type to filter the query on
QueryException
public static String[] getTypeNames(Class type) throws WTIntrospectionException
type
- the type whose parent types should be returned
WTIntrospectionException
public static WTContainerRef[] getAncestorArray(WTContainerRef container) throws WTException
WTContainerRef
s that
includes the specified container plus all of its ancestors. The
containers are returned ordered from the specified container up
to the root container.
container
- the container whose ancestors should be returned
WTException
static QuerySpec getBasicSpec(RuleType ruleType, Boolean defaultRule, Boolean enabled) throws WTException
QuerySpec
that queries the
TypeBasedRule
table for rules that meet the specified
criteria.
If any parameter is null then a condition for that attribute is not added to the query specification.
ruleType
- the rule type to filter the results ondefaultRule
- the defaultRule value to filter the results onenabled
- the enabled value to filter the results on
WTException
static StatementSpec getTypeHierarchySpec(QuerySpec qs, String[] typeNames) throws WTException
StatementSpec
that returns the IDs of all
TypeBasedRule
s that meet the conditions in the query
spec that is passed in and have their OBJ_TYPE
attribute
set equal to one of the type names in the typeNames
list.
The statement spec orders the results to be consistent with the order
of the type names in the typeNames
list: all rules whose
OBJ_TYPE
attribute is equal to the first type name in the list
are first in the result set, followed by the rules whose OBJ_TYPE
attribute is equal to the second type name in the list, and so on.
NOTE: Use this query with Jon B.'s enhanced lookup function
qs
- a query spec for TypeBasedRuletypeNames
- a list of type names to use to filter the result set
WTException
getWhereTypeIs(java.lang.String)
private static StatementSpec getTypeHierarchySpec(QuerySpec qs, WTContainerRef[] containers, String[] typeNames) throws WTException
StatementSpec
that returns the IDs of all
TypeBasedRule
s that meet the conditions in the query
spec that is passed in and are contained in one of the containers in
the containers
list and have their OBJ_TYPE
attribute set equal to one of the typenames in the typeNames
list.
The statement spec orders the results to be consistent with the order
of the containers in the containers
list. All rules that
are contained in the first container in the containers
list
are first in the result set, followed by the rules that are contained
in the second container in the containers
list, and so on.
Rules that belong to the same container are ordered to be consistent with
the order of the type names in the typeNames
list. All rules
whose OBJ_TYPE
attribute is equal to the first type name in the
list are first in the result set, followed by the rules whose
OBJ_TYPE
attribute is equal to the second type name in the list,
and so on.
NOTE: Use this query with Jon B.'s enhanced lookup function
qs
- a query spec for TypeBasedRulecontainers
- a list of containers to use to filter the result settypeNames
- a list of type names to use to filter the result set
WTException
getWhereTypeIs(java.lang.String)
,
WTContainerHelper.getWhereContainerIs(wt.inf.container.WTContainer)
public static QuerySpec createBasicQuerySpec(Class table, RuleType ruleType, boolean defaultRule, boolean enabled) throws WTException
QuerySpec
that can be used
as the basis for querying for Rule
s: either
InstanceBasedRule
s or TypeBasedRule
s
(or another Rule
subclass).
table
- the table to query (the class of rule)ruleType
- the desired rule typeenabled
- whether only enabled rules should be searched for
WTException
static WTArrayList inflateIDs(QueryResult ids, boolean first_match) throws WTException
ids
- the query result containg only object identifiersfirst_match
- whether the first result in the query should only be returned
WTException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |