|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Representation of a (database) query. It is modifiable for use by bridge-users.
Queries| Field Summary |
| Fields inherited from interface org.mmbase.storage.search.SearchQuery |
DEFAULT_MAX_NUMBER, DEFAULT_OFFSET |
| Method Summary | |
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 addSortOrder(StepField, int, boolean) (sorting case
insensitively). |
SortOrder |
addSortOrder(StepField f,
int direction,
boolean caseSensitive)
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. |
Object |
clone()
Create an (unused) clone |
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 contraint (for use with this Query object). |
FieldValueConstraint |
createConstraint(StepField f,
int op,
Object v)
Create a contraint (for use with this Query object). |
FieldValueConstraint |
createConstraint(StepField f,
int op,
Object v,
int part)
Create a contraint (for use with this Query object). |
CompareFieldsConstraint |
createConstraint(StepField f,
int op,
StepField v)
Create a contraint (for use with this Query object). |
FieldValueConstraint |
createConstraint(StepField f,
Object v)
Create a contraint (for use with this Query object). |
FieldValueBetweenConstraint |
createConstraint(StepField f,
Object o1,
Object o2)
Create a contraint (for use with this Query object). |
FieldValueInConstraint |
createConstraint(StepField f,
SortedSet v)
Create a contraint (for use with this Query object). |
LegacyConstraint |
createConstraint(String s)
Create a contraint (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 fieldIdentifer)
Creates the step field for the given name. |
Constraint |
getCleanConstraint()
Gets the 'clean' constraint on this query. |
Cloud |
getCloud()
Returns the Cloud for which this Query was defined. |
NodeList |
getList()
Executes the query and returns the resulting node list. |
Step |
getStep(String stepAlias)
Returns the step with given alias, or null if it is not present |
boolean |
isAggregating()
Whether this query is 'aggregating'. |
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 |
setAlias(Step step,
String alias)
Sets the alias to the given step. |
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. |
| Methods inherited from interface org.mmbase.storage.search.SearchQuery |
equals, getConstraint, getFields, getMaxNumber, getOffset, getSortOrders, getSteps, hashCode, toString |
| Methods inherited from interface org.mmbase.bridge.Cacheable |
getCachePolicy, setCachePolicy |
| Method Detail |
public Cloud getCloud()
public boolean isAggregating()
isAggregating in interface SearchQuerytrue if the query is aggregatingpublic Step addStep(NodeManager nodeManager)
nodeManager - The nodeManager associated with the step.
IllegalArgumentException - when an invalid argument is supplied.addRelationStep(NodeManager)
public void setAlias(Step step,
String alias)
step - step to add the alias foralias - The alias which must be given to the step. If it is "" an alias should be
generated. 'null' removes the alias.public Step getStep(String stepAlias)
stepAlias - Alias for the step (may also be tableName, in which case the first step for this table is returned)
public RelationStep addRelationStep(NodeManager nodeManager,
String role,
String searchDir)
getNext() on
the relationstep, and cast to Step.
nodeManager - node manager on the other side of the relationrole - role of a relationsearchDir - the direction of the relation
IllegalArgumentException - when an invalid argument is supplied.
IllegalStateException - when there is no previous step.public RelationStep addRelationStep(NodeManager otherManager)
otherManager - node manager on the other side of the relation
public StepField addField(Step step,
Field field)
step - step to add field tofield - field to add
public StepField addField(String field)
field - field to add
public void removeFields()
public StepField createStepField(Step step,
Field field)
step - step to create StepField fromfield - field to create StepField from
public StepField createStepField(Step step,
String fieldName)
step - step to create StepField fromfieldName - name of field to create StepField from
public StepField createStepField(String fieldIdentifer)
fieldIdentifer - field identifier to create StepField from
public AggregatedField addAggregatedField(Step step,
Field field,
int aggregationType)
step - step to add field tofield - field to addaggregationType - Type of aggregation
public Query setDistinct(boolean distinct)
distinct - 'distinct' results
BasicSearchQuery.setDistinct(boolean),
isDistinct()public boolean isDistinct()
SearchQueryThis corresponds to the use of "DISTINCT" in SQL SELECT-syntax .
isDistinct in interface SearchQuerySearchQuery.isDistinct()public Query setMaxNumber(int maxNumber)
maxNumber - max number of results
BasicSearchQuery.setMaxNumber(int)public Query setOffset(int offset)
offset - offset in results
BasicSearchQuery.setOffset(int)public Constraint getCleanConstraint()
public LegacyConstraint createConstraint(String s)
s - String with LegacyConstraint
Cloud.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)
f - Stepfield
public FieldValueConstraint createConstraint(StepField f,
Object v)
f - fieldv - value
public FieldValueConstraint createConstraint(StepField f,
int op,
Object v)
f - fieldop - operatorv - value
public FieldValueConstraint createConstraint(StepField f,
int op,
Object v,
int part)
f - fieldop - operatorv - valuepart - part of the date value
public CompareFieldsConstraint createConstraint(StepField f,
int op,
StepField v)
f - fieldop - operatorv - value
public FieldValueBetweenConstraint createConstraint(StepField f,
Object o1,
Object o2)
f - fieldo1 - value oneo2 - value two
public FieldValueInConstraint createConstraint(StepField f,
SortedSet v)
f - fieldv - value
public FieldConstraint setCaseSensitive(FieldConstraint constraint,
boolean sensitive)
constraint - constraint to changesensitive - case sensitivity
public Constraint setInverse(Constraint c,
boolean i)
c - constrainti - inverse
public CompositeConstraint createConstraint(Constraint c1,
int op,
Constraint c2)
c1 - constraint oneop - operator (CompositeConstraint.LOGICAL_AND, CompositeConstraint.LOGICAL_OR)c2 - constraint two
public void setConstraint(Constraint c)
c - constraint
public SortOrder addSortOrder(StepField f,
int direction,
boolean caseSensitive)
f - fielddirection - ASCENDING or DESCENDING
BasicSearchQuery.addSortOrder(org.mmbase.storage.search.StepField)
public SortOrder addSortOrder(StepField f,
int direction)
addSortOrder(StepField, int, boolean) (sorting case
insensitively).
public void addNode(Step s,
Node node)
s - stepnode - node to add
public void addNode(Step s,
int number)
public boolean isUsed()
public boolean markUsed()
public Object clone()
public Query cloneWithoutFields()
public Query aggregatingClone()
public NodeList getList()
public String toSql()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||