org.mmbase.bridge.implementation
Class BasicNodeQuery

java.lang.Object
  extended byorg.mmbase.bridge.implementation.BasicQuery
      extended byorg.mmbase.bridge.implementation.BasicNodeQuery
All Implemented Interfaces:
java.lang.Cloneable, NodeQuery, Query, SearchQuery

public class BasicNodeQuery
extends BasicQuery
implements NodeQuery

'Basic' implementation of bridge NodeQuery. Wraps a Query with all and only fields of one Step. If there is only one step, this can wrap NodeSearchQuery of core. Often, queries with more steps are sensible nodequeries, because sorting (e.g. posrel.pos) or filtering can be done on those steps (e.g. publishtimes). Nodes of this type can be used as an argument to function which do return 'real' nodes (so not clusternodes).

Since:
MMBase-1.7
Version:
$Id: BasicNodeQuery.java,v 1.18.2.1 2004/07/29 17:16:37 michiel Exp $
Author:
Michiel Meeuwissen
See Also:
NodeSearchQuery
To Do:
perhaps it would be nice to have the possibllity to query also two complete steps (also one of the neigbouring 'relation' steps). this would give nice efficient implementations of things like mm:relatednode (of mm:listrelations), This kind of functionality should perhaps be present in NodeSearchQuery itself because you can then use it 'under' the bridge too.

Field Summary
protected  Step step
           
 
Fields inherited from class org.mmbase.bridge.implementation.BasicQuery
aggregating, cloud, explicitFields, implicitFields, insecureConstraint, query, queryCheck, used
 
Fields inherited from interface org.mmbase.storage.search.SearchQuery
DEFAULT_MAX_NUMBER, DEFAULT_OFFSET
 
Method Summary
protected  void addFields(java.util.Collection c)
          Adds all fields of the gives collection, unless it is a field of the 'step' itself
 Query cloneWithoutFields()
          Clones this object, only without the fields
 StepField createStepField(java.lang.String fieldName)
          Creates the step field for the given name.
 NodeManager getNodeManager()
          Returns the node-manager.
 Step getNodeStep()
          Returns the step for which the fields are added (or null)
 StepField getStepField(Field field)
          Since in a NodeQuery one of the steps is 'exceptional', also this function makes sense now.
 void removeFields()
          Removes all fields from the Query object.
 Query setDistinct(boolean distinct)
          Specifies wether the query result must contain only 'distinct' results.
 Step setNodeStep(Step step)
          Removes all fields and add all fields of the given step.
 
Methods inherited from class org.mmbase.bridge.implementation.BasicQuery
addAggregatedField, addField, addField, addFieldImplicit, addNode, addNode, addRelationStep, addRelationStep, addRelationStep, addRelationStep, addSortOrder, addStep, aggregatingClone, clone, createAlias, createConstraint, createConstraint, createConstraint, createConstraint, createConstraint, createConstraint, createConstraint, createConstraint, createNewQuery, createStepField, createStepField, equals, getCleanConstraint, getCloud, getConstraint, getFields, getMaxNumber, getOffset, getSortOrders, getStep, getSteps, glueAlias, hashCode, isAggregating, isDistinct, isUsed, markUsed, removeSecurityConstraintFromClone, setAlias, setCaseSensitive, setConstraint, setInverse, setMaxNumber, setOffset, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.bridge.Query
addAggregatedField, addField, addField, addNode, addRelationStep, addRelationStep, addSortOrder, addStep, aggregatingClone, clone, createConstraint, createConstraint, createConstraint, createConstraint, createConstraint, createConstraint, createConstraint, createConstraint, createStepField, createStepField, getCleanConstraint, getCloud, getStep, isAggregating, isUsed, markUsed, setAlias, setCaseSensitive, setConstraint, setInverse, setMaxNumber, setOffset
 
Methods inherited from interface org.mmbase.storage.search.SearchQuery
equals, getConstraint, getFields, getMaxNumber, getOffset, getSortOrders, getSteps, hashCode, isDistinct, toString
 

Field Detail

step

protected Step step
Method Detail

getNodeManager

public NodeManager getNodeManager()
Description copied from interface: NodeQuery
Returns the node-manager. Or 'null' if this is not yet determined.

Specified by:
getNodeManager in interface NodeQuery

getNodeStep

public Step getNodeStep()
Description copied from interface: NodeQuery
Returns the step for which the fields are added (or null)

Specified by:
getNodeStep in interface NodeQuery

createStepField

public StepField createStepField(java.lang.String fieldName)
Description copied from interface: Query
Creates the step field for the given name. For a NodeQuery the arguments is simply the name of the field. For a 'normal' query, it should be prefixed by the (automatic) alias of the Step.

Specified by:
createStepField in interface Query
Overrides:
createStepField in class BasicQuery

getStepField

public StepField getStepField(Field field)
Description copied from interface: NodeQuery
Since in a NodeQuery one of the steps is 'exceptional', also this function makes sense now.

Specified by:
getStepField in interface NodeQuery
Returns:
null if field is not of 'the' nodemanager.

removeFields

public void removeFields()
Description copied from interface: Query
Removes all fields from the Query object.

Specified by:
removeFields in interface Query
Overrides:
removeFields in class BasicQuery

addFields

protected void addFields(java.util.Collection c)
Adds all fields of the gives collection, unless it is a field of the 'step' itself


setDistinct

public Query setDistinct(boolean distinct)
Description copied from interface: Query
Specifies wether the query result must contain only 'distinct' results.

Specified by:
setDistinct in interface Query
Overrides:
setDistinct in class BasicQuery

setNodeStep

public Step setNodeStep(Step step)
Description copied from interface: NodeQuery
Removes all fields and add all fields of the given step. This also can have an effect on the result of getNodeManager().

Specified by:
setNodeStep in interface NodeQuery
Returns:
the previously associated step (if there was one, otherwise null).

cloneWithoutFields

public Query cloneWithoutFields()
Description copied from interface: Query
Clones this object, only without the fields

Specified by:
cloneWithoutFields in interface Query
Overrides:
cloneWithoutFields in class BasicQuery


MMBase build 1.7.1.20041002