org.apache.jackrabbit.core.query
Class RelationQueryNode

java.lang.Object
  extended byorg.apache.jackrabbit.core.query.QueryNode
      extended byorg.apache.jackrabbit.core.query.RelationQueryNode
All Implemented Interfaces:
QueryConstants

public class RelationQueryNode
extends QueryNode
implements QueryConstants

Implements a query node that defines property value relation.


Field Summary
 
Fields inherited from class org.apache.jackrabbit.core.query.QueryNode
TYPE_AND, TYPE_DEREF, TYPE_EXACT, TYPE_LOCATION, TYPE_NODETYPE, TYPE_NOT, TYPE_OR, TYPE_ORDER, TYPE_PATH, TYPE_RELATION, TYPE_ROOT, TYPE_TEXTSEARCH
 
Fields inherited from interface org.apache.jackrabbit.core.query.QueryConstants
OPERATION_BETWEEN, OPERATION_EQ_GENERAL, OPERATION_EQ_VALUE, OPERATION_GE_GENERAL, OPERATION_GE_VALUE, OPERATION_GT_GENERAL, OPERATION_GT_VALUE, OPERATION_IN, OPERATION_LE_GENERAL, OPERATION_LE_VALUE, OPERATION_LIKE, OPERATION_LT_GENERAL, OPERATION_LT_VALUE, OPERATION_NE_GENERAL, OPERATION_NE_VALUE, OPERATION_NOT_NULL, OPERATION_NULL, OPERATIONS, TYPE_DATE, TYPE_DOUBLE, TYPE_LONG, TYPE_POSITION, TYPE_STRING, TYPE_TIMESTAMP
 
Constructor Summary
RelationQueryNode(QueryNode parent, int operation)
          Creates a new RelationQueryNode without a type nor value assigned.
RelationQueryNode(QueryNode parent, QName property, Date value, int operation)
          Creates a new RelationQueryNode with a Date value and an operation type.
RelationQueryNode(QueryNode parent, QName property, double value, int operation)
          Creates a new RelationQueryNode with a double value and an operation type.
RelationQueryNode(QueryNode parent, QName property, long value, int operation)
          Creates a new RelationQueryNode with a long value and an operation type.
RelationQueryNode(QueryNode parent, QName property, String value, int operation)
          Creates a new RelationQueryNode with a String value and an operation type.
 
Method Summary
 Object accept(QueryNodeVisitor visitor, Object data)
          Accepts a QueryNodeVisitor and calls the apropriate visit method on the visitor depending on the concrete implementation of this QueryNode.
 boolean equals(Object obj)
          Returns true if obj is the same type of QueryNode as this node and is equal to this node.
 Date getDateValue()
          Returns the Date value if this relation if of type QueryConstants.TYPE_DATE.
 double getDoubleValue()
          Returns the double value if this relation if of type QueryConstants.TYPE_DOUBLE.
 long getLongValue()
          Returns the long value if this relation if of type QueryConstants.TYPE_LONG.
 int getOperation()
          Returns the operation type.
 int getPositionValue()
          Returns the int position index value if this relation is of type QueryConstants.TYPE_POSITION.
 QName getProperty()
          Returns the name of the property in this relation query node.
 String getStringValue()
          Returns the String value if this relation if of type QueryConstants.TYPE_STRING.
 int getType()
          Returns the type of this node.
 int getValueType()
          Returns the type of the value.
 void setDateValue(Date value)
          Sets a new value of type Date.
 void setDoubleValue(double value)
          Sets a new value of type double.
 void setLongValue(long value)
          Sets a new value of type long.
 void setPositionValue(int value)
          Sets a new value for the position index.
 void setProperty(QName name)
          Sets a new property name for this relation query node.
 void setStringValue(String value)
          Sets a new value of type String.
 void setUnaryMinus(boolean b)
          If b is true then the value in this relation node contains a receding unary minus.
 
Methods inherited from class org.apache.jackrabbit.core.query.QueryNode
dump, getParent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationQueryNode

public RelationQueryNode(QueryNode parent,
                         int operation)
Creates a new RelationQueryNode without a type nor value assigned.

Parameters:
parent - the parent node for this query node.

RelationQueryNode

public RelationQueryNode(QueryNode parent,
                         QName property,
                         long value,
                         int operation)
Creates a new RelationQueryNode with a long value and an operation type.

Parameters:
parent - the parent node for this query node.
property - the name of a property.
value - a property value
operation - the type of the relation.

RelationQueryNode

public RelationQueryNode(QueryNode parent,
                         QName property,
                         double value,
                         int operation)
Creates a new RelationQueryNode with a double value and an operation type.

Parameters:
parent - the parent node for this query node.
property - the name of a property.
value - a property value
operation - the type of the relation.

RelationQueryNode

public RelationQueryNode(QueryNode parent,
                         QName property,
                         Date value,
                         int operation)
Creates a new RelationQueryNode with a Date value and an operation type.

Parameters:
parent - the parent node for this query node.
property - the name of a property.
value - a property value
operation - the type of the relation.

RelationQueryNode

public RelationQueryNode(QueryNode parent,
                         QName property,
                         String value,
                         int operation)
Creates a new RelationQueryNode with a String value and an operation type.

Parameters:
parent - the parent node for this query node.
property - the name of a property.
value - a property value
operation - the type of the relation.
Method Detail

accept

public Object accept(QueryNodeVisitor visitor,
                     Object data)
Accepts a QueryNodeVisitor and calls the apropriate visit method on the visitor depending on the concrete implementation of this QueryNode.

Specified by:
accept in class QueryNode
Parameters:
visitor - the visitor to call back.
data - arbitrary data for the visitor.
Returns:
the return value of the visitor.visit() call.

getType

public int getType()
Returns the type of this node.

Specified by:
getType in class QueryNode
Returns:
the type of this node.

setUnaryMinus

public void setUnaryMinus(boolean b)
If b is true then the value in this relation node contains a receding unary minus.

Parameters:
b - true if this relation contains a unary minus.

getValueType

public int getValueType()
Returns the type of the value.

Returns:
the type of the value.

getProperty

public QName getProperty()
Returns the name of the property in this relation query node.

Returns:
the name of the property in this relation query node.

setProperty

public void setProperty(QName name)
Sets a new property name for this relation query node.

Parameters:
name - the new property name.

getLongValue

public long getLongValue()
Returns the long value if this relation if of type QueryConstants.TYPE_LONG.

Returns:
the long value.

setLongValue

public void setLongValue(long value)
Sets a new value of type long.

Parameters:
value - the new value.

getPositionValue

public int getPositionValue()
Returns the int position index value if this relation is of type QueryConstants.TYPE_POSITION.

Returns:
the position index value.

setPositionValue

public void setPositionValue(int value)
Sets a new value for the position index.

Parameters:
value - the new value.

getDoubleValue

public double getDoubleValue()
Returns the double value if this relation if of type QueryConstants.TYPE_DOUBLE.

Returns:
the double value.

setDoubleValue

public void setDoubleValue(double value)
Sets a new value of type double.

Parameters:
value - the new value.

getStringValue

public String getStringValue()
Returns the String value if this relation if of type QueryConstants.TYPE_STRING.

Returns:
the String value.

setStringValue

public void setStringValue(String value)
Sets a new value of type String.

Parameters:
value - the new value.

getDateValue

public Date getDateValue()
Returns the Date value if this relation if of type QueryConstants.TYPE_DATE.

Returns:
the Date value.

setDateValue

public void setDateValue(Date value)
Sets a new value of type Date.

Parameters:
value - the new value.

getOperation

public int getOperation()
Returns the operation type.

Returns:
the operation type.

equals

public boolean equals(Object obj)
Description copied from class: QueryNode
Returns true if obj is the same type of QueryNode as this node and is equal to this node.

Specified by:
equals in class QueryNode
Parameters:
obj - the reference object with which to compare.
Returns:
true if obj is equal to this; false otherwise.


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.