|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.bridge.implementation.BasicQuery
public class BasicQuery
'Basic' implementation of bridge Query. Wraps a 'BasicSearchQuery' from core.
This implementation is actually ussuable with other implementations of bridge too, because it has the public constructor:
BasicQuery(Cloud, BasicSearchQuery).
BasicSearchQuery,
Serialized Form| Field Summary | |
|---|---|
protected boolean |
aggregating
Whether this Query is aggregating. |
protected Cloud |
cloud
reference to the cloud. |
protected List<BasicStepField> |
explicitFields
The explicitely added 'extra' fields. |
protected List<BasicStepField> |
implicitFields
The implicitely added 'extra' fields. |
protected Constraint |
insecureConstraint
If a the constraint was made 'secure', in insecureConstraint the original Constraint is stored. |
protected BasicSearchQuery |
query
The core query which is 'wrapped' |
protected Authorization.QueryCheck |
queryCheck
The QueryCheck object associated with this Query, or null if no such object was determined yet. |
protected boolean |
used
Whether this Query was used already. |
| Fields inherited from interface org.mmbase.storage.search.SearchQuery |
|---|
DEFAULT_MAX_NUMBER, DEFAULT_OFFSET |
| Constructor Summary | |
|---|---|
BasicQuery(Cloud c)
|
|
BasicQuery(Cloud c,
BasicSearchQuery q)
|
|
BasicQuery(Cloud c,
boolean aggregating)
|
|
| 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 fieldIdentifier)
Adds a field by string |
protected void |
addFieldImplicit(Step step,
Field field)
Fields which are added 'implicity' should be added by this function. |
void |
addNode(Step s,
int nodeNumber)
|
void |
addNode(Step s,
Node node)
Adds a node to a step. |
RelationStep |
addRelationStep(NodeManager otherNodeManager)
If you need to add a 'related' NodeManager without specifying a role/searchDir simply use these addRelationStep. |
RelationStep |
addRelationStep(NodeManager otherNodeManager,
String role,
String direction)
Adds new Relation step to the query. |
protected RelationStep |
addRelationStep(NodeManager otherNodeManager,
String role,
String direction,
boolean warnOnImpossibleStep)
|
protected BasicRelationStep |
addRelationStep(String insrel,
NodeManager otherNodeManager,
int direction)
|
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 nm)
Adds a NodeManager to this Query. |
Query |
aggregatingClone()
Creates an unused aggregate clone of this query. |
BasicQuery |
clone()
Create an (unused) clone |
Query |
cloneWithoutFields()
Clones this object, only without the fields |
protected String |
createAlias(String name)
Creates a unique alias for this Query based on a given base String |
CompositeConstraint |
createConstraint(Constraint c1,
int operator,
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). |
protected void |
createNewQuery()
|
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. |
BasicSearchQuery |
getQuery()
|
List<SortOrder> |
getSortOrders()
Gets the SortOrder objects in the order they are to be applied. |
String |
getSql()
Getter for use in EL. |
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. |
protected String |
glueAlias(String aliasBase,
Integer seq)
Glues a string and integer together to a new string. |
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. |
(package private) boolean |
isSecure()
|
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()
|
(package private) void |
removeSecurityConstraint()
Remove a previously set security constraint (if set one) |
protected void |
removeSecurityConstraintFromClone(BasicSearchQuery clone)
|
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 c,
boolean s)
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. |
(package private) void |
setSecurityConstraint(Authorization.QueryCheck c)
Applies a security-constraint to this Query. |
String |
toSql()
Shows the query in a human-readable SQL form. |
String |
toString()
Returns a string representation of this SearchQuery. |
SearchQuery |
unwrap()
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected boolean used
protected boolean aggregating
protected Authorization.QueryCheck queryCheck
protected Constraint insecureConstraint
protected BasicSearchQuery query
protected Cloud cloud
protected List<BasicStepField> implicitFields
protected List<BasicStepField> explicitFields
| Constructor Detail |
|---|
public BasicQuery(Cloud c)
public BasicQuery(Cloud c,
boolean aggregating)
public BasicQuery(Cloud c,
BasicSearchQuery q)
| Method Detail |
|---|
public BasicSearchQuery getQuery()
public SearchQuery unwrap()
unwrap in interface SearchQueryWrapperprotected void createNewQuery()
public 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 Constraint getCleanConstraint()
Query
getCleanConstraint in interface Querypublic 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 isDistinct()
SearchQueryThis corresponds to the use of "DISTINCT" in SQL SELECT-syntax .
isDistinct in interface SearchQuerypublic boolean isAggregating()
SearchQuery
isAggregating in interface SearchQuerypublic CachePolicy getCachePolicy()
Cacheable
getCachePolicy in interface CacheableCachePolicy object.public void setCachePolicy(CachePolicy policy)
Cacheable
setCachePolicy in interface Cacheablepolicy - the CachePolicy object.protected void removeSecurityConstraintFromClone(BasicSearchQuery clone)
public BasicQuery clone()
Query
clone in interface Queryclone in interface PublicCloneable<Query>clone in class Objectpublic Query aggregatingClone()
Query
aggregatingClone in interface Querypublic Query cloneWithoutFields()
Query
cloneWithoutFields in interface Queryprotected String createAlias(String name)
protected String glueAlias(String aliasBase,
Integer seq)
public Step addStep(NodeManager nm)
Query
addStep in interface Querynm - The nodeManager associated with the step.
Query.addRelationStep(NodeManager)
public void setAlias(Step step,
String alias)
Query
setAlias in interface Querystep - 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.
protected BasicRelationStep addRelationStep(String insrel,
NodeManager otherNodeManager,
int direction)
public RelationStep addRelationStep(NodeManager otherNodeManager)
Query
addRelationStep in interface QueryotherNodeManager - node manager on the other side of the relation
public RelationStep addRelationStep(NodeManager otherNodeManager,
String role,
String direction)
Query getNext() on
the relationstep, and cast to Step.
addRelationStep in interface QueryotherNodeManager - node manager on the other side of the relationrole - role of a relationdirection - the direction of the relation
protected RelationStep addRelationStep(NodeManager otherNodeManager,
String role,
String direction,
boolean warnOnImpossibleStep)
public void removeFields()
Query
removeFields in interface Query
public StepField addField(Step step,
Field field)
Query
addField in interface Querystep - step to add field tofield - field to add
public StepField addField(String fieldIdentifier)
Query
addField in interface QueryfieldIdentifier - field to add
protected void addFieldImplicit(Step step,
Field field)
public StepField createStepField(Step step,
Field field)
Query
createStepField in interface Querystep - step to create StepField fromfield - field to create StepField from
public StepField createStepField(Step step,
String fieldName)
Query
createStepField in interface Querystep - step to create StepField fromfieldName - name of field to create StepField from
public Step getStep(String stepAlias)
Query
getStep in interface QuerystepAlias - Alias for the step (may also be tableName, in which case the first step for this table is returned)
public StepField createStepField(String fieldIdentifier)
Query
createStepField in interface QueryfieldIdentifier - field identifier to create StepField from
public AggregatedField addAggregatedField(Step step,
Field field,
int aggregationType)
Query
addAggregatedField in interface Querystep - step to add field tofield - field to addaggregationType - Type of aggregation
public void removeImplicitFields()
removeImplicitFields in interface Querypublic Query setDistinct(boolean distinct)
Query
setDistinct in interface Querydistinct - 'distinct' results
BasicSearchQuery.setDistinct(boolean),
SearchQuery.isDistinct()public Query setMaxNumber(int maxNumber)
Query
setMaxNumber in interface QuerymaxNumber - max number of results
BasicSearchQuery.setMaxNumber(int)public Query setOffset(int offset)
Query
setOffset in interface Queryoffset - offset in results
BasicSearchQuery.setOffset(int)public LegacyConstraint createConstraint(String s)
Query
createConstraint in interface Querys - 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)
Query
createConstraint in interface Queryf - Stepfield
public FieldValueConstraint createConstraint(StepField f,
Object v)
Query
createConstraint in interface Queryf - fieldv - value
public FieldValueConstraint createConstraint(StepField f,
int op,
Object v,
int part)
Query
createConstraint in interface Queryf - fieldop - operatorv - valuepart - part of the date value
public FieldValueConstraint createConstraint(StepField f,
int op,
Object v)
Query
createConstraint in interface Queryf - fieldop - operatorv - value
public CompareFieldsConstraint createConstraint(StepField f,
int op,
StepField v)
Query
createConstraint in interface Queryf - fieldop - operatorv - value
public FieldValueBetweenConstraint createConstraint(StepField f,
Object o1,
Object o2)
Query
createConstraint in interface Queryf - fieldo1 - value oneo2 - value two
public FieldValueInConstraint createConstraint(StepField f,
SortedSet<? extends Object> v)
Query
createConstraint in interface Queryf - fieldv - value
public FieldValueInQueryConstraint createConstraint(StepField f,
Query q)
createConstraint in interface Query
public Constraint setInverse(Constraint c,
boolean i)
Query
setInverse in interface Queryc - constrainti - inverse
public FieldConstraint setCaseSensitive(FieldConstraint c,
boolean s)
Query
setCaseSensitive in interface Queryc - constraint to changes - case sensitivity
public CompositeConstraint createConstraint(Constraint c1,
int operator,
Constraint c2)
Query
createConstraint in interface Queryc1 - constraint oneoperator - operator (CompositeConstraint.LOGICAL_AND, CompositeConstraint.LOGICAL_OR)c2 - constraint two
public void setConstraint(Constraint c)
Query
setConstraint in interface Queryc - constraint
public 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_DESCENDING
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 sensitivity
public SortOrder addSortOrder(StepField f,
int direction,
boolean caseSensitive,
int part)
Query
addSortOrder in interface Queryf - fielddirection - SortOrder.ORDER_ASCENDING or SortOrder.ORDER_DESCENDINGcaseSensitive - case sensitivitypart - part to sort on for a date value
BasicSearchQuery.addSortOrder(org.mmbase.storage.search.StepField)
public void addNode(Step s,
int nodeNumber)
addNode in interface Querys - query stepnodeNumber - node number
public void addNode(Step s,
Node node)
Query
addNode in interface Querys - stepnode - node to addpublic boolean isUsed()
Query
isUsed in interface Querypublic boolean markUsed()
Query
markUsed in interface QuerymarkUsed in interface SearchQueryboolean isSecure()
void setSecurityConstraint(Authorization.QueryCheck c)
removeSecurityConstraint()void removeSecurityConstraint()
setSecurityConstraint(org.mmbase.security.Authorization.QueryCheck)public Cloud getCloud()
Query
getCloud in interface Querypublic NodeList getList()
Query
getList in interface Querypublic 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 String getSql()
toSql().
public String toSql()
Query
toSql in interface Query
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||