org.modeshape.graph.query
Class QueryBuilder.ConstraintBuilder

java.lang.Object
  extended by org.modeshape.graph.query.QueryBuilder.ConstraintBuilder
All Implemented Interfaces:
QueryBuilder.DynamicOperandBuilder
Direct Known Subclasses:
QueryBuilder.LowerCaser, QueryBuilder.UpperCaser
Enclosing class:
QueryBuilder

public class QueryBuilder.ConstraintBuilder
extends Object
implements QueryBuilder.DynamicOperandBuilder


Constructor Summary
protected QueryBuilder.ConstraintBuilder(QueryBuilder.ConstraintBuilder parent)
           
 
Method Summary
 QueryBuilder.ConstraintBuilder and()
          Signal that the previous constraint clause be AND-ed together with another constraint clause that will be defined immediately after this method call.
protected  QueryBuilder.ConstraintBuilder buildLogicalConstraint()
           
 QueryBuilder.ConstraintBuilder closeParen()
          Complete the specification of a constraint clause, and return the builder for the parent constraint clause.
protected  QueryBuilder.ComparisonBuilder comparisonBuilder(DynamicOperand operand)
           
 QueryBuilder.ComparisonBuilder depth(String table)
          Constrains the nodes in the the supplied table based upon criteria on the node's depth.
 QueryBuilder end()
          Complete this constraint specification.
 QueryBuilder.ComparisonBuilder fullTextSearchScore(String table)
          Constrains the nodes in the the supplied table such that they must satisfy the supplied full-text search on the nodes' property values.
 QueryBuilder.ConstraintBuilder hasProperty(String table, String propertyName)
          Define a constraint clause that the node within the named table has at least one value for the named property.
 QueryBuilder.ConstraintBuilder isBelowPath(String descendantTable, String ancestorPath)
          Define a constraint clause that the node within the named table is a descendant of the node at the supplied path.
 QueryBuilder.ConstraintBuilder isChild(String childTable, String parentPath)
          Define a constraint clause that the node within the named table is the child of the node at the supplied path.
 QueryBuilder.ConstraintBuilder isSameNode(String table, String asNodeAtPath)
          Define a constraint clause that the node within the named table is the same node as that appearing at the supplied path.
 QueryBuilder.ComparisonBuilder length(String table, String property)
          Constrains the nodes in the the supplied table such that they must have a property value whose length matches the criteria.
 QueryBuilder.DynamicOperandBuilder lowerCaseOf()
          Begin a constraint against the lowercase form of a dynamic operand.
 QueryBuilder.ComparisonBuilder nodeLocalName(String table)
          Constrains the nodes in the the supplied table based upon criteria on the node's local name.
 QueryBuilder.ComparisonBuilder nodeName(String table)
          Constrains the nodes in the the supplied table based upon criteria on the node's name.
 QueryBuilder.ConstraintBuilder not()
          Signal that the next constraint clause (defined immediately after this method) should be negated.
 QueryBuilder.ConstraintBuilder openParen()
          Simulate the use of an open parenthesis in the constraint.
 QueryBuilder.ConstraintBuilder or()
          Signal that the previous constraint clause be OR-ed together with another constraint clause that will be defined immediately after this method call.
 QueryBuilder.ComparisonBuilder path(String table)
          Constrains the nodes in the the supplied table based upon criteria on the node's path.
 QueryBuilder.ComparisonBuilder propertyValue(String table, String property)
          Constrains the nodes in the the supplied table such that they must have a matching value for the named property.
 QueryBuilder.ComparisonBuilder referenceValue(String table)
          Constrains the nodes in the the supplied table such that they must have a matching value for any of the node's reference properties.
 QueryBuilder.ComparisonBuilder referenceValue(String table, String property)
          Constrains the nodes in the the supplied table such that they must have a matching value for the named property.
 QueryBuilder.ConstraintBuilder search(String table, String searchExpression)
          Define a constraint clause that the node within the named table have at least one property that satisfies the full-text search expression.
 QueryBuilder.ConstraintBuilder search(String table, String propertyName, String searchExpression)
          Define a constraint clause that the node within the named table have a value for the named property that satisfies the full-text search expression.
protected  QueryBuilder.ConstraintBuilder setConstraint(Constraint constraint)
           
 QueryBuilder.DynamicOperandBuilder upperCaseOf()
          Begin a constraint against the uppercase form of a dynamic operand.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryBuilder.ConstraintBuilder

protected QueryBuilder.ConstraintBuilder(QueryBuilder.ConstraintBuilder parent)
Method Detail

end

public QueryBuilder end()
Complete this constraint specification.

Returns:
the query builder, for method chaining purposes

openParen

public QueryBuilder.ConstraintBuilder openParen()
Simulate the use of an open parenthesis in the constraint. The resulting builder should be used to define the constraint within the parenthesis, and should always be terminated with a closeParen().

Returns:
the constraint builder that should be used to define the portion of the constraint within the parenthesis; never null
See Also:
closeParen()

closeParen

public QueryBuilder.ConstraintBuilder closeParen()
Complete the specification of a constraint clause, and return the builder for the parent constraint clause.

Returns:
the constraint builder that was used to create this parenthetical constraint clause builder; never null
Throws:
IllegalStateException - if there was not an open parenthesis to close

and

public QueryBuilder.ConstraintBuilder and()
Signal that the previous constraint clause be AND-ed together with another constraint clause that will be defined immediately after this method call.

Returns:
the constraint builder for the remaining constraint clause; never null

or

public QueryBuilder.ConstraintBuilder or()
Signal that the previous constraint clause be OR-ed together with another constraint clause that will be defined immediately after this method call.

Returns:
the constraint builder for the remaining constraint clause; never null

not

public QueryBuilder.ConstraintBuilder not()
Signal that the next constraint clause (defined immediately after this method) should be negated.

Returns:
the constraint builder for the constraint clause that is to be negated; never null

buildLogicalConstraint

protected QueryBuilder.ConstraintBuilder buildLogicalConstraint()

isSameNode

public QueryBuilder.ConstraintBuilder isSameNode(String table,
                                                 String asNodeAtPath)
Define a constraint clause that the node within the named table is the same node as that appearing at the supplied path.

Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
asNodeAtPath - the path to the node
Returns:
the constraint builder that was used to create this clause; never null

isChild

public QueryBuilder.ConstraintBuilder isChild(String childTable,
                                              String parentPath)
Define a constraint clause that the node within the named table is the child of the node at the supplied path.

Parameters:
childTable - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
parentPath - the path to the parent node
Returns:
the constraint builder that was used to create this clause; never null

isBelowPath

public QueryBuilder.ConstraintBuilder isBelowPath(String descendantTable,
                                                  String ancestorPath)
Define a constraint clause that the node within the named table is a descendant of the node at the supplied path.

Parameters:
descendantTable - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
ancestorPath - the path to the ancestor node
Returns:
the constraint builder that was used to create this clause; never null

hasProperty

public QueryBuilder.ConstraintBuilder hasProperty(String table,
                                                  String propertyName)
Define a constraint clause that the node within the named table has at least one value for the named property.

Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
propertyName - the name of the property
Returns:
the constraint builder that was used to create this clause; never null

search

public QueryBuilder.ConstraintBuilder search(String table,
                                             String searchExpression)
Define a constraint clause that the node within the named table have at least one property that satisfies the full-text search expression.

Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
searchExpression - the full-text search expression
Returns:
the constraint builder that was used to create this clause; never null

search

public QueryBuilder.ConstraintBuilder search(String table,
                                             String propertyName,
                                             String searchExpression)
Define a constraint clause that the node within the named table have a value for the named property that satisfies the full-text search expression.

Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
propertyName - the name of the property to be searched
searchExpression - the full-text search expression
Returns:
the constraint builder that was used to create this clause; never null

comparisonBuilder

protected QueryBuilder.ComparisonBuilder comparisonBuilder(DynamicOperand operand)

length

public QueryBuilder.ComparisonBuilder length(String table,
                                             String property)
Constrains the nodes in the the supplied table such that they must have a property value whose length matches the criteria.

Specified by:
length in interface QueryBuilder.DynamicOperandBuilder
Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
property - the name of the property; may not be null and must refer to a valid property name
Returns:
the interface for completing the value portion of the criteria specification; never null
See Also:
QueryBuilder.DynamicOperandBuilder.length(java.lang.String, java.lang.String)

propertyValue

public QueryBuilder.ComparisonBuilder propertyValue(String table,
                                                    String property)
Constrains the nodes in the the supplied table such that they must have a matching value for the named property.

Specified by:
propertyValue in interface QueryBuilder.DynamicOperandBuilder
Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
property - the name of the property; may not be null and must refer to a valid property name
Returns:
the interface for completing the value portion of the criteria specification; never null
See Also:
QueryBuilder.DynamicOperandBuilder.propertyValue(String, String)

referenceValue

public QueryBuilder.ComparisonBuilder referenceValue(String table)
Constrains the nodes in the the supplied table such that they must have a matching value for any of the node's reference properties.

Specified by:
referenceValue in interface QueryBuilder.DynamicOperandBuilder
Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
Returns:
the interface for completing the value portion of the criteria specification; never null
See Also:
QueryBuilder.DynamicOperandBuilder.referenceValue(java.lang.String)

referenceValue

public QueryBuilder.ComparisonBuilder referenceValue(String table,
                                                     String property)
Constrains the nodes in the the supplied table such that they must have a matching value for the named property.

Specified by:
referenceValue in interface QueryBuilder.DynamicOperandBuilder
Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
property - the name of the reference property; may be null if the constraint applies to all/any reference properties on the node
Returns:
the interface for completing the value portion of the criteria specification; never null
See Also:
QueryBuilder.DynamicOperandBuilder.referenceValue(java.lang.String, java.lang.String)

fullTextSearchScore

public QueryBuilder.ComparisonBuilder fullTextSearchScore(String table)
Constrains the nodes in the the supplied table such that they must satisfy the supplied full-text search on the nodes' property values.

Specified by:
fullTextSearchScore in interface QueryBuilder.DynamicOperandBuilder
Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
Returns:
the interface for completing the value portion of the criteria specification; never null
See Also:
QueryBuilder.DynamicOperandBuilder.fullTextSearchScore(String)

depth

public QueryBuilder.ComparisonBuilder depth(String table)
Constrains the nodes in the the supplied table based upon criteria on the node's depth.

Specified by:
depth in interface QueryBuilder.DynamicOperandBuilder
Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
Returns:
the interface for completing the value portion of the criteria specification; never null
See Also:
QueryBuilder.DynamicOperandBuilder.depth(java.lang.String)

path

public QueryBuilder.ComparisonBuilder path(String table)
Constrains the nodes in the the supplied table based upon criteria on the node's path.

Specified by:
path in interface QueryBuilder.DynamicOperandBuilder
Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
Returns:
the interface for completing the value portion of the criteria specification; never null
See Also:
QueryBuilder.DynamicOperandBuilder.path(java.lang.String)

nodeLocalName

public QueryBuilder.ComparisonBuilder nodeLocalName(String table)
Constrains the nodes in the the supplied table based upon criteria on the node's local name.

Specified by:
nodeLocalName in interface QueryBuilder.DynamicOperandBuilder
Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
Returns:
the interface for completing the value portion of the criteria specification; never null
See Also:
QueryBuilder.DynamicOperandBuilder.nodeLocalName(String)

nodeName

public QueryBuilder.ComparisonBuilder nodeName(String table)
Constrains the nodes in the the supplied table based upon criteria on the node's name.

Specified by:
nodeName in interface QueryBuilder.DynamicOperandBuilder
Parameters:
table - the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the FROM clause
Returns:
the interface for completing the value portion of the criteria specification; never null
See Also:
QueryBuilder.DynamicOperandBuilder.nodeName(String)

upperCaseOf

public QueryBuilder.DynamicOperandBuilder upperCaseOf()
Begin a constraint against the uppercase form of a dynamic operand.

Specified by:
upperCaseOf in interface QueryBuilder.DynamicOperandBuilder
Returns:
the interface for completing the criteria specification; never null
See Also:
QueryBuilder.DynamicOperandBuilder.upperCaseOf()

lowerCaseOf

public QueryBuilder.DynamicOperandBuilder lowerCaseOf()
Begin a constraint against the lowercase form of a dynamic operand.

Specified by:
lowerCaseOf in interface QueryBuilder.DynamicOperandBuilder
Returns:
the interface for completing the criteria specification; never null
See Also:
QueryBuilder.DynamicOperandBuilder.lowerCaseOf()

setConstraint

protected QueryBuilder.ConstraintBuilder setConstraint(Constraint constraint)


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.