|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sap.ip.me.api.smartsync.SmartSyncJQueryFactory
Query factory class for join enabled queries. The queries are reusable, read-only objects that allow filtering the data in a container. Usually, you create the query on first use, store it into a static field and then re-use it later.
The query interface also supports sorting. To enable sorting, simply add attribute terms on which you wish to sort when creating the query.
Conditions should be added from left to right with decreasing selectivity.
SmartSyncJQuery factory can be used with JDBC Persistence to implement optimized queries with join support. A JQuery does only return field values and not complete Structures by default. See Persistence JQuery Javadoc for more details.
JQuery
,
JQueryAttribute
,
JQueryCondition
,
JQueryParameter
,
JQuerySortOrder
,
JQueryGroupBy
Constructor Summary | |
SmartSyncJQueryFactory()
|
Method Summary | |
abstract JQueryAttribute |
createAggregate(JQueryAttribute attr,
AggregationOperatorType aggreg)
Create an aggregate on the query attribute. |
abstract JQueryAttribute |
createAttribute(FieldDescriptor fieldName)
Create a query attribute. |
abstract JQueryAttribute |
createAttribute(FieldDescriptor fieldName,
java.lang.Object tag)
Create a query attribute. |
abstract JQueryCondition |
createCondition(JQueryAttribute left,
java.lang.Object[] right)
Create simple IN condition. |
abstract JQueryCondition |
createCondition(JQueryAttribute left,
java.lang.Object[] right,
java.lang.Object tag)
Create named simple IN condition. |
abstract JQueryCondition |
createCondition(JQueryAttribute left,
RelationalOperatorType operator,
JQueryAttribute right)
Create simple condition. |
abstract JQueryCondition |
createCondition(JQueryAttribute left,
RelationalOperatorType operator,
JQueryParameter right)
Create simple condition with parameterized right operand. |
abstract JQueryCondition |
createCondition(JQueryAttribute left,
RelationalOperatorType operator,
java.lang.Object right)
Create simple condition. |
abstract JQueryCondition |
createCondition(JQueryAttribute left,
RelationalOperatorType operator,
java.lang.Object right,
java.lang.Object tag)
Create named simple condition. |
abstract JQueryCondition |
createCondition(JQueryCondition[] conditions,
LogicalOperatorType operator)
Construct n-ary logical operator. |
abstract JQueryCondition |
createCondition(JQueryCondition left,
LogicalOperatorType operator,
JQueryCondition right)
Construct binary logical operator. |
abstract JQueryCondition |
createCondition(LogicalOperatorType operator,
JQueryCondition right)
Construct unary logical operator. |
abstract JQueryGroupBy |
createGroupBy(JQueryAttribute[] groupBy)
Create group by for the specified attributes in the same order as the delivered JQueryAttribute[] |
abstract JQueryCondition |
createLinkCondition(RowDescriptor sourceRow,
RowDescriptor targetRow)
Create link condition between top row and child row or between related rows. |
abstract JQueryParameter |
createParameter(java.lang.Object defaultValue)
Create query parameter. |
abstract JQueryParameter |
createParameter(java.lang.Object defaultValue,
java.lang.Object tag)
Create named query parameter. |
abstract JQuery |
createQuery(JQueryAttribute[] attributes,
JQueryCondition cond)
Create query based on specified attributes and condition. |
abstract JQuery |
createQuery(JQueryAttribute[] attributes,
JQueryCondition cond,
boolean distinct)
Create query based on specified attributes and condition. |
abstract JQuery |
createQuery(JQueryAttribute[] attributes,
JQueryCondition cond,
boolean distinct,
JQuerySortOrder sortOrder)
Create sorted query based on specified attributes and condition. |
abstract JQuery |
createQuery(JQueryAttribute[] attributes,
JQueryCondition cond,
boolean distinct,
JQuerySortOrder[] sortOrders)
Create sorted query based on specified attributes and condition. |
abstract JQuery |
createQuery(JQueryAttribute[] attributes,
JQueryCondition cond,
boolean distinct,
JQuerySortOrder[] sortOrders,
JQueryGroupBy groupBy)
Create sorted and grouped query based on specified attributes and condition. |
abstract JQuery |
createQuery(JQueryAttribute[] attributes,
JQueryCondition cond,
JQuerySortOrder sortOrder)
Create sorted query based on specified attributes and condition. |
abstract JQuery |
createQuery(JQueryAttribute[] attributes,
JQueryCondition cond,
JQuerySortOrder[] sortOrders)
Create sorted query based on specified attributes and condition. |
abstract JQuery |
createQuery(JQueryAttribute[] attributes,
JQueryCondition cond,
JQuerySortOrder[] sortOrders,
JQueryGroupBy groupBy)
Create sorted and grouped query based on specified attributes and condition. |
abstract JQuerySortOrder |
createSortOrder(JQueryAttribute attribute)
Create ascending sort order on given attribute. |
abstract JQuerySortOrder |
createSortOrder(JQueryAttribute attribute,
boolean ascending)
Create sort order on given attribute. |
abstract JQuerySortOrder |
createSortOrder(JQuerySortOrder[] orders)
Deprecated. |
static SmartSyncJQueryFactory |
getInstance()
Deprecated. use SmartSyncRuntime.getJQueryFactory() instead. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SmartSyncJQueryFactory()
Method Detail |
public abstract JQuery createQuery(JQueryAttribute[] attributes, JQueryCondition cond) throws java.lang.IllegalArgumentException
attributes
- attributes used in this query.cond
- condition to use to filter results.
java.lang.IllegalArgumentException
- if condition uses
attributes not mentioned in attributes parameter.public abstract JQuery createQuery(JQueryAttribute[] attributes, JQueryCondition cond, JQuerySortOrder[] sortOrders) throws java.lang.IllegalArgumentException
attributes
- attributes used in this query.cond
- condition to use to filter results.sortOrders
- sort orders to use for this query or null to use default sorting.
java.lang.IllegalArgumentException
- if condition or sort orders use
attributes not mentioned in attributes parameter.public abstract JQuery createQuery(JQueryAttribute[] attributes, JQueryCondition cond, JQuerySortOrder sortOrder) throws java.lang.IllegalArgumentException
attributes
- attributes used in this query.cond
- condition to use to filter results.sortOrder
- sort order to use for this query or null to use default sorting.
java.lang.IllegalArgumentException
- if condition or sort orders use
attributes not mentioned in attributes parameter.public abstract JQuery createQuery(JQueryAttribute[] attributes, JQueryCondition cond, boolean distinct) throws java.lang.IllegalArgumentException
attributes
- attributes used in this query.cond
- condition to use to filter results.distinct
- if true, select only distinct rows (no duplicates).
java.lang.IllegalArgumentException
- if condition uses
attributes not mentioned in attributes parameter.public abstract JQuery createQuery(JQueryAttribute[] attributes, JQueryCondition cond, boolean distinct, JQuerySortOrder[] sortOrders) throws java.lang.IllegalArgumentException
attributes
- attributes used in this query.cond
- condition to use to filter results.distinct
- if true, select only distinct rows (no duplicates).sortOrders
- sort orders to use for this query or null to use default sorting.
java.lang.IllegalArgumentException
- if condition or sort orders use
attributes not mentioned in attributes parameter.public abstract JQuery createQuery(JQueryAttribute[] attributes, JQueryCondition cond, boolean distinct, JQuerySortOrder sortOrder) throws java.lang.IllegalArgumentException
attributes
- attributes used in this query.cond
- condition to use to filter results.distinct
- if true, select only distinct rows (no duplicates).sortOrder
- sort order to use for this query or null to use default sorting.
java.lang.IllegalArgumentException
- if condition or sort orders use
attributes not mentioned in attributes parameter.public abstract JQuery createQuery(JQueryAttribute[] attributes, JQueryCondition cond, JQuerySortOrder[] sortOrders, JQueryGroupBy groupBy) throws java.lang.IllegalArgumentException
attributes
- attributes used in this query.cond
- condition to use to filter results.sortOrders
- sort order to use for this query or null to use default sorting.groupBy
- grouping to use for this query or null to use no grouping
java.lang.IllegalArgumentException
- if condition or sort orders use
attributes not mentioned in attributes parameter.public abstract JQuery createQuery(JQueryAttribute[] attributes, JQueryCondition cond, boolean distinct, JQuerySortOrder[] sortOrders, JQueryGroupBy groupBy) throws java.lang.IllegalArgumentException
attributes
- attributes used in this query.cond
- condition to use to filter results.distinct
- if true, select only distinct rows (no duplicates).sortOrders
- sort order to use for this query or null to use default sorting.groupBy
- grouping to use for this query or null to use no grouping
java.lang.IllegalArgumentException
- if condition or sort orders use
attributes not mentioned in attributes parameter.public abstract JQueryAttribute createAttribute(FieldDescriptor fieldName)
fieldName
- field name in candidate class to bind to this term.
public abstract JQueryAttribute createAttribute(FieldDescriptor fieldName, java.lang.Object tag)
fieldName
- field name in candidate class to bind to this term.tag
- identificator tag.
public abstract JQueryAttribute createAggregate(JQueryAttribute attr, AggregationOperatorType aggreg)
attr
- attribute to change to aggregate.aggreg
- aggregation function to use.
public abstract JQueryGroupBy createGroupBy(JQueryAttribute[] groupBy)
groupBy
- attributes to group by in the given order
public abstract JQueryParameter createParameter(java.lang.Object defaultValue)
defaultValue
- default value for this parameter.
public abstract JQueryParameter createParameter(java.lang.Object defaultValue, java.lang.Object tag)
defaultValue
- default value for this parameter.tag
- identificator tag.
public abstract JQuerySortOrder createSortOrder(JQueryAttribute attribute)
Make sure that the corresponding FieldDescriptor is indexed for best performance!
attribute
- attribute to sort.
public abstract JQuerySortOrder createSortOrder(JQueryAttribute attribute, boolean ascending)
Make sure that the corresponding FieldDescriptor is indexed for best performance!
attribute
- attribute to sort.ascending
- if true, sort ascending.
public abstract JQuerySortOrder createSortOrder(JQuerySortOrder[] orders)
orders
- sort orders to join.
public abstract JQueryCondition createCondition(JQueryAttribute left, RelationalOperatorType operator, JQueryParameter right) throws java.lang.IllegalArgumentException
left
- left operand.operator
- comparison operator.right
- right operand as parameter.
java.lang.IllegalArgumentException
- if the operator is invalid,
one of terms is null or the term types do not match.public abstract JQueryCondition createCondition(JQueryAttribute left, RelationalOperatorType operator, JQueryAttribute right) throws java.lang.IllegalArgumentException
left
- left operand.operator
- comparison operator.right
- right operand as parameter.
java.lang.IllegalArgumentException
- if the operator is invalid,
one of terms is null or the term types do not match.public abstract JQueryCondition createCondition(JQueryAttribute left, RelationalOperatorType operator, java.lang.Object right) throws java.lang.IllegalArgumentException
left
- left operand.operator
- comparison operator.right
- directly specified parameter (can be array for IN operator).
java.lang.IllegalArgumentException
- if the operator is invalid,
one of terms is null or the term types do not match.public abstract JQueryCondition createCondition(JQueryAttribute left, java.lang.Object[] right) throws java.lang.IllegalArgumentException
left
- left operand.right
- directly specified parameter (array for IN operator).
java.lang.IllegalArgumentException
- if the type doesn't match.public abstract JQueryCondition createCondition(JQueryAttribute left, RelationalOperatorType operator, java.lang.Object right, java.lang.Object tag) throws java.lang.IllegalArgumentException
left
- left operand.operator
- comparison operator.right
- directly specified parameter (can be array for IN operator).tag
- parameter identificator tag to be used for implicitly created parameter.
java.lang.IllegalArgumentException
- if the operator is invalid,
one of terms is null or the term types do not match.public abstract JQueryCondition createCondition(JQueryAttribute left, java.lang.Object[] right, java.lang.Object tag) throws java.lang.IllegalArgumentException
left
- left operand.right
- directly specified parameter (array for IN operator).tag
- parameter identificator tag to be used for implicitly created parameter.
java.lang.IllegalArgumentException
- if the type doesn't match.public abstract JQueryCondition createLinkCondition(RowDescriptor sourceRow, RowDescriptor targetRow)
SyncBo.getRows(RowDescriptor)
or binding of
related rows, effectively replacing Row.getRelatedRow(RowDescriptor)
and Row.getRelatingRows(RowDescriptor)
. Method versions with Query
as parameter are replaced by defining other conditions on this query in
addition to link condition.
Let's say, we have SyncBO A with row A1 field A1F that relates to key of
row B2 in SyncBO B. To replace A.getRelatedRow(B), create a link condition
between A and B and parameter condition binding key of A to row key
you are interested in (Row.getKey()
and bind those two with AND.
Similarly, to get all relating rows A relating to a particular row B,
create a link condition between A and B and parameter condition binding
key of B to row key you are interested in and bind those two with AND.
In both cases, this builds a join query over two tables, which is executed
faster as comparable old query.
To query all child rows B belonging to particular SyncBo with given topRow A, create a link condition between A and B and parameter condition binding key of A to given topRow key.
Example for creating alink condition between related rows (see assumption above):
RowDescriptor A = ... //the source (top Row or child Row) which has a Field that has a relation to Row B RowDescriptor B = ... //the target (top Row) to which A's field is pointing to. JQueryCondition linkCondition = smartSyncJQueryFactory.createCondition(A, B);
Example for creating a link condition between top row and child row:
SyncBo syncBo = ... RowDescriptor topRow = syncBo.getTopRow(); RowDescriptor childRow = syncBo.getChildRow(); JQueryCondition linkCondition = smartSyncJQueryFactory.createCondition(topRow, childRow);
sourceRow
- when searching for a Relation between a Field and a SyncBo this is the RowDescriptor
of the source (Field). When searching for a parent - child link this
is the top RowDescriptor of the SyncBo.targetRow
- when searching for a Relation between a Field and a SyncBo this is the RowDescriptor
of the target (Row). When searching for a parent - child link this
is the child RowDescriptor of the SyncBo.SyncBo.getTopRow()
,
Row.getSyncBo()
,
FieldDescriptor.getRelatedRelation()
,
RelationDescriptor
public abstract JQueryCondition createCondition(JQueryCondition left, LogicalOperatorType operator, JQueryCondition right) throws java.lang.IllegalArgumentException
left
- left operand.operator
- logical operator.right
- right operand.
java.lang.IllegalArgumentException
- if an invalid operator is
specified or one of operands is null.public abstract JQueryCondition createCondition(JQueryCondition[] conditions, LogicalOperatorType operator) throws java.lang.IllegalArgumentException
conditions
- operands.operator
- logical operator.
java.lang.IllegalArgumentException
- if an invalid operator is
specified or one of operands is null.public abstract JQueryCondition createCondition(LogicalOperatorType operator, JQueryCondition right) throws java.lang.IllegalArgumentException
operator
- logical operator (currently only NOT supported).right
- right operand.
java.lang.IllegalArgumentException
- if an invalid operator is specified
or the operand is null.public static SmartSyncJQueryFactory getInstance()
SmartSyncRuntime.getJQueryFactory()
instead.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |