public abstract class AbstractQueryWrapper<Q extends Query> extends Object implements Query
QueryWrapper and NodeQueryWrapper.| Modifier and Type | Field and Description |
|---|---|
protected Q |
query |
DEFAULT_MAX_NUMBER, DEFAULT_OFFSET| Modifier | Constructor and Description |
|---|---|
protected |
AbstractQueryWrapper(Q q) |
| Modifier and Type | Method and Description |
|---|---|
AggregatedField |
addAggregatedField(Step step,
Field field,
int aggregationType)
Add an aggregated field to a step
|
StepField |
addField(Step step,
Field field)
Adds a field to a step.
|
StepField |
addField(String field)
Adds a field by string
|
void |
addNode(Step s,
int number) |
void |
addNode(Step s,
Node node)
Adds a node to a step.
|
RelationStep |
addRelationStep(NodeManager otherManager)
If you need to add a 'related' NodeManager without specifying a role/searchDir
simply use these addRelationStep.
|
RelationStep |
addRelationStep(NodeManager nodeManager,
String role,
String searchDir)
Adds new Relation step to the query.
|
SortOrder |
addSortOrder(StepField f,
int direction)
Defaulting version of
Query.addSortOrder(StepField, int, boolean, int) (sorting case
insensitively, and no date parts). |
SortOrder |
addSortOrder(StepField f,
int direction,
boolean caseSensitive)
Defaulting version of
Query.addSortOrder(StepField, int, boolean, int) (no date parts) |
SortOrder |
addSortOrder(StepField f,
int direction,
boolean caseSensitive,
int part)
Adds an order on a certain field.
|
Step |
addStep(NodeManager nodeManager)
Adds a NodeManager to this Query.
|
Query |
aggregatingClone()
Creates an unused aggregate clone of this query.
|
Query |
clone()
Create an (unused) clone
|
void |
cloneQuery() |
Query |
cloneWithoutFields()
Clones this object, only without the fields
|
CompositeConstraint |
createConstraint(Constraint c1,
int op,
Constraint c2)
Combines two Constraints to one new one, using a boolean operator (AND or OR).
|
FieldNullConstraint |
createConstraint(StepField f)
Create a constraint (for use with this Query object).
|
FieldValueConstraint |
createConstraint(StepField f,
int op,
Object v)
Create a constraint (for use with this Query object).
|
FieldValueConstraint |
createConstraint(StepField f,
int op,
Object v,
int part)
Create a constraint (for use with this Query object).
|
CompareFieldsConstraint |
createConstraint(StepField f,
int op,
StepField v)
Create a constraint (for use with this Query object).
|
FieldValueConstraint |
createConstraint(StepField f,
Object v)
Create a constraint (for use with this Query object).
|
FieldValueBetweenConstraint |
createConstraint(StepField f,
Object o1,
Object o2)
Create a constraint (for use with this Query object).
|
FieldValueInQueryConstraint |
createConstraint(StepField f,
Query q) |
FieldValueInConstraint |
createConstraint(StepField f,
SortedSet<? extends Object> v)
Create a constraint (for use with this Query object).
|
LegacyConstraint |
createConstraint(String s)
Create a constraint (for use with this Query object).
|
StepField |
createStepField(Step step,
Field field)
Creates a StepField object withouth adding it (needed for aggregated queries).
|
StepField |
createStepField(Step step,
String fieldName)
Creates a StepField object withouth adding it (needed for aggregated queries).
|
StepField |
createStepField(String fieldIdentifier)
Creates the step field for the given name.
|
boolean |
equals(Object obj)
Compares this query to the specified object.
|
CachePolicy |
getCachePolicy()
Returns the CachePolicy of the object.
|
Constraint |
getCleanConstraint()
Gets the 'clean' constraint on this query.
|
Cloud |
getCloud()
Returns the Cloud for which this Query was defined.
|
Constraint |
getConstraint()
Gets the constraints on the search results.
|
List<StepField> |
getFields()
Gets the stepfields in the search request.
|
NodeList |
getList()
Executes the query and returns the resulting node list.
|
int |
getMaxNumber()
Gets the maximum number of results to be returned, or -1 if the number of results to be returned is unlimited.
|
int |
getOffset()
Gets the (zerobased) offset in the list of results, of the first result to return.
|
Q |
getQuery() |
List<SortOrder> |
getSortOrders()
Gets the SortOrder objects in the order they are to be applied.
|
String |
getSql() |
Step |
getStep(String stepAlias)
Returns the step with given alias, or null if it is not present
|
List<Step> |
getSteps()
Gets the steps in the search request.
|
int |
hashCode() |
boolean |
isAggregating()
Tests if this is an aggregating query, i.e.
|
boolean |
isDistinct()
Tests if the search request is to return distinct results.
|
boolean |
isUsed()
Whether this query was used or not.
|
boolean |
markUsed()
Mark this query 'used'.
|
void |
removeFields()
Removes all fields from the Query object.
|
void |
removeImplicitFields() |
void |
setAlias(Step step,
String alias)
Sets the alias to the given step.
|
void |
setCachePolicy(CachePolicy policy)
Sets the CachePolicy of the query.
|
FieldConstraint |
setCaseSensitive(FieldConstraint constraint,
boolean sensitive)
Changes the given constraint's 'case sensitivity' (if applicable).
|
void |
setConstraint(Constraint c)
The (composite) constraint can actually be set into the query with this method.
|
Query |
setDistinct(boolean distinct)
Specifies wether the query result must contain only 'distinct' results.
|
Constraint |
setInverse(Constraint c,
boolean i)
Changes the given constraint's 'inverse' (if applicable).
|
Query |
setMaxNumber(int maxNumber)
Limits the query-result to maxNumber records.
|
Query |
setOffset(int offset)
Offsets the query-result with offset records.
|
String |
toSql()
Shows the query in a human-readable SQL form.
|
String |
toString()
Returns a string representation of this SearchQuery.
|
SearchQuery |
unwrap() |
protected AbstractQueryWrapper(Q q)
public void cloneQuery()
public String getSql()
public Q getQuery()
public SearchQuery unwrap()
unwrap in interface SearchQueryWrapperpublic Cloud getCloud()
Querypublic Step addStep(NodeManager nodeManager)
QueryaddStep in interface QuerynodeManager - The nodeManager associated with the step.Query.addRelationStep(NodeManager)public void setAlias(Step step, String alias)
Querypublic Step getStep(String stepAlias)
Querypublic RelationStep addRelationStep(NodeManager nodeManager, String role, String searchDir)
Query getNext() on
the relationstep, and cast to Step.addRelationStep in interface QuerynodeManager - node manager on the other side of the relationrole - role of a relationsearchDir - the direction of the relationpublic RelationStep addRelationStep(NodeManager otherManager)
QueryaddRelationStep in interface QueryotherManager - node manager on the other side of the relationpublic StepField addField(Step step, Field field)
Querypublic StepField addField(String field)
Querypublic void removeFields()
QueryremoveFields in interface Querypublic StepField createStepField(Step step, Field field)
QuerycreateStepField in interface Querystep - step to create StepField fromfield - field to create StepField frompublic StepField createStepField(Step step, String fieldName)
QuerycreateStepField in interface Querystep - step to create StepField fromfieldName - name of field to create StepField frompublic StepField createStepField(String fieldIdentifier)
QuerycreateStepField in interface QueryfieldIdentifier - field identifier to create StepField frompublic AggregatedField addAggregatedField(Step step, Field field, int aggregationType)
QueryaddAggregatedField in interface Querystep - step to add field tofield - field to addaggregationType - Type of aggregationpublic Query setDistinct(boolean distinct)
QuerysetDistinct in interface Querydistinct - 'distinct' resultsBasicSearchQuery.setDistinct(boolean),
SearchQuery.isDistinct()public Query setMaxNumber(int maxNumber)
QuerysetMaxNumber in interface QuerymaxNumber - max number of resultsBasicSearchQuery.setMaxNumber(int)public Query setOffset(int offset)
QuerysetOffset in interface Queryoffset - offset in resultsBasicSearchQuery.setOffset(int)public Constraint getCleanConstraint()
QuerygetCleanConstraint in interface Querypublic LegacyConstraint createConstraint(String s)
QuerycreateConstraint in interface Querys - String with LegacyConstraintCloud.getList(String startNodes, String nodePath, String fields, String constraints, String orderby, String directions, String searchDir, boolean distinct),
NodeManager.getList(String constraints, String orderby, String directions)public FieldNullConstraint createConstraint(StepField f)
QuerycreateConstraint in interface Queryf - Stepfieldpublic FieldValueConstraint createConstraint(StepField f, Object v)
QuerycreateConstraint in interface Queryf - fieldv - valuepublic FieldValueConstraint createConstraint(StepField f, int op, Object v)
QuerycreateConstraint in interface Queryf - fieldop - operatorv - valuepublic FieldValueConstraint createConstraint(StepField f, int op, Object v, int part)
QuerycreateConstraint in interface Queryf - fieldop - operatorv - valuepart - part of the date valuepublic CompareFieldsConstraint createConstraint(StepField f, int op, StepField v)
QuerycreateConstraint in interface Queryf - fieldop - operatorv - valuepublic FieldValueBetweenConstraint createConstraint(StepField f, Object o1, Object o2)
QuerycreateConstraint in interface Queryf - fieldo1 - value oneo2 - value twopublic FieldValueInConstraint createConstraint(StepField f, SortedSet<? extends Object> v)
QuerycreateConstraint in interface Queryf - fieldv - valuepublic FieldValueInQueryConstraint createConstraint(StepField f, Query q)
createConstraint in interface Querypublic FieldConstraint setCaseSensitive(FieldConstraint constraint, boolean sensitive)
QuerysetCaseSensitive in interface Queryconstraint - constraint to changesensitive - case sensitivitypublic Constraint setInverse(Constraint c, boolean i)
QuerysetInverse in interface Queryc - constrainti - inversepublic CompositeConstraint createConstraint(Constraint c1, int op, Constraint c2)
QuerycreateConstraint in interface Queryc1 - constraint oneop - operator (CompositeConstraint.LOGICAL_AND, CompositeConstraint.LOGICAL_OR)c2 - constraint twopublic void setConstraint(Constraint c)
QuerysetConstraint in interface Queryc - constraintpublic SortOrder addSortOrder(StepField f, int direction, boolean caseSensitive, int part)
QueryaddSortOrder in interface Queryf - fielddirection - SortOrder.ORDER_ASCENDING or SortOrder.ORDER_DESCENDINGcaseSensitive - case sensitivitypart - part to sort on for a date valueBasicSearchQuery.addSortOrder(org.mmbase.storage.search.StepField)public SortOrder addSortOrder(StepField f, int direction, boolean caseSensitive)
QueryQuery.addSortOrder(StepField, int, boolean, int) (no date parts)addSortOrder in interface Queryf - fielddirection - SortOrder.ORDER_ASCENDING or SortOrder.ORDER_DESCENDINGcaseSensitive - case sensitivitypublic SortOrder addSortOrder(StepField f, int direction)
QueryQuery.addSortOrder(StepField, int, boolean, int) (sorting case
insensitively, and no date parts).addSortOrder in interface Queryf - fielddirection - SortOrder.ORDER_ASCENDING or SortOrder.ORDER_DESCENDINGpublic void addNode(Step s, Node node)
Querypublic void addNode(Step s, int number)
public boolean isUsed()
Querypublic boolean markUsed()
QuerymarkUsed in interface QuerymarkUsed in interface SearchQuerypublic Query cloneWithoutFields()
QuerycloneWithoutFields in interface Querypublic Query aggregatingClone()
QueryaggregatingClone in interface Querypublic NodeList getList()
Querypublic String toSql()
Querypublic void removeImplicitFields()
removeImplicitFields in interface Querypublic boolean isDistinct()
SearchQueryThis corresponds to the use of "DISTINCT" in SQL SELECT-syntax .
isDistinct in interface SearchQuerypublic boolean isAggregating()
SearchQueryisAggregating in interface SearchQuerypublic List<Step> getSteps()
SearchQueryThis corresponds to the tables in SQL SELECT-syntax.
getSteps in interface SearchQuerypublic List<StepField> getFields()
SearchQueryThis corresponds to the fields in SQL SELECT-syntax.
getFields in interface SearchQuerypublic Constraint getConstraint()
SearchQueryThis corresponds to (part of) the constraints in the WHERE-clause in SQL SELECT-syntax.
getConstraint in interface SearchQuerypublic int getMaxNumber()
SearchQueryNote: limiting the number of results may not be supported by the database layer.
getMaxNumber in interface SearchQuerypublic int getOffset()
SearchQueryNote: skipping results may not be supported by the database layer.
getOffset in interface SearchQuerypublic List<SortOrder> getSortOrders()
SearchQueryThis corresponds to the ORDER BY clause in SQL SELECT syntax.
getSortOrders in interface SearchQuerypublic boolean equals(Object obj)
SearchQuerytrue if and only if the argument is a non-null
SearchQuery object representing the same query.equals in interface SearchQueryequals in class Objectobj - The object to compare with.true if the objects are equal,
false otherwise.public int hashCode()
hashCode in interface SearchQueryhashCode in class Objectpublic String toString()
SearchQueryisDistinct()
getSteps()
getFields()
getConstraint()
getSortOrders()
getMaxNumber()
getOffset()
toString in interface SearchQuerytoString in class Objectpublic CachePolicy getCachePolicy()
CacheablegetCachePolicy in interface CacheableCachePolicy object.public void setCachePolicy(CachePolicy policy)
CacheablesetCachePolicy in interface Cacheablepolicy - the CachePolicy object.MMBase 1.9-SNAPSHOT - ${javadoctimestamp}