org.xcmis.search.model
Class Query

java.lang.Object
  extended by org.xcmis.search.model.Query
All Implemented Interfaces:
Serializable, QueryElement

public class Query
extends Object
implements QueryElement, Serializable

Version:
$Id: Query.java 34360 2009-07-22 23:58:59Z ksm $
Author:
Sergey Kabashnyuk
See Also:
Serialized Form

Constructor Summary
Query(Source source)
          Create a new query that uses the supplied source.
Query(Source source, Constraint constraint, List<Ordering> orderings, List<Column> columns, Limit limit)
          Create a new query that uses the supplied source, constraint, orderings, columns and limits.
 
Method Summary
 void accept(QueryObjectModelVisitor visitor)
          Accepts a visitor and calls the appropriate visit method depending on the type of this QOM node.
 Query adding(Column... columns)
          Create a copy of this query, but that returns results that include the columns specified by this query as well as the supplied columns.
 Query adding(Ordering... orderings)
          Create a copy of this query, but that returns results that are ordered by the orderings of this column as well as those supplied.
 Query constrainedBy(Constraint constraint)
          Create a copy of this query, but one that uses the supplied constraint.
 Query distinct()
          Create a copy of this query, but one in which there are no duplicate rows in the results.
 boolean equals(Object obj)
          
 List<Column> getColumns()
          Return the columns defining the query results.
 Constraint getConstraint()
          Get the constraints, if there are any.
 Limit getLimits()
          Get the limits associated with this query.
 List<Ordering> getOrderings()
          Return the orderings for this query.
 Source getSource()
          Get the source for the results.
 int hashCode()
          
 Query orderedBy(List<Ordering> orderings)
          Create a copy of this query, but one whose results should be ordered by the supplied orderings.
 Query returning(List<Column> columns)
          Create a copy of this query, but that returns results with the supplied columns.
 String toString()
          
 Query withLimit(int rowLimit)
          Create a copy of this query, but one that uses the supplied limit on the number of result rows.
 Query withOffset(int offset)
          Create a copy of this query, but one that uses the supplied offset.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Query

public Query(Source source)
Create a new query that uses the supplied source.

Parameters:
source - the source

Query

public Query(Source source,
             Constraint constraint,
             List<Ordering> orderings,
             List<Column> columns,
             Limit limit)
Create a new query that uses the supplied source, constraint, orderings, columns and limits.

Parameters:
source - the source
constraint - the constraint (or composite constraint), or null or empty if there are no constraints
orderings - the specifications of how the results are to be ordered, or null if the order is to be implementation determined
columns - the columns to be included in the results, or null or empty if there are no explicit columns and the actual result columns are to be implementation determiend
limit - the limit for the results, or null if all of the results are to be included
isDistinct - true if duplicates are to be removed from the results
Throws:
IllegalArgumentException - if the source is null
Method Detail

accept

public void accept(QueryObjectModelVisitor visitor)
            throws VisitException
Description copied from interface: QueryElement
Accepts a visitor and calls the appropriate visit method depending on the type of this QOM node.

Specified by:
accept in interface QueryElement
Parameters:
visitor - the visitor.
Throws:
VisitException
See Also:
QueryElement.accept(org.xcmis.search.QueryObjectModelVisitor)

adding

public Query adding(Column... columns)
Create a copy of this query, but that returns results that include the columns specified by this query as well as the supplied columns.

Parameters:
columns - the additional columns that should be included in the the results; may not be null
Returns:
the copy of the query returning the supplied result columns; never null

adding

public Query adding(Ordering... orderings)
Create a copy of this query, but that returns results that are ordered by the orderings of this column as well as those supplied.

Parameters:
orderings - the additional orderings of the result rows; may no be null
Returns:
the copy of the query returning the supplied result columns; never null

constrainedBy

public Query constrainedBy(Constraint constraint)
Create a copy of this query, but one that uses the supplied constraint.

Parameters:
constraint - the constraint that should be used; never null
Returns:
the copy of the query that uses the supplied constraint; never null

distinct

public Query distinct()
Create a copy of this query, but one in which there are no duplicate rows in the results.

Returns:
the copy of the query with no duplicate result rows; never null

equals

public boolean equals(Object obj)

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

getColumns

public final List<Column> getColumns()
Return the columns defining the query results. If there are no columns, then the columns are implementation determined.

Returns:
the list of columns; never null

getConstraint

public final Constraint getConstraint()
Get the constraints, if there are any.

Returns:
the constraint; may be null

getLimits

public final Limit getLimits()
Get the limits associated with this query.

Returns:
the limits; never null but possibly unlimited

getOrderings

public final List<Ordering> getOrderings()
Return the orderings for this query.

Returns:
the list of orderings; never null

getSource

public final Source getSource()
Get the source for the results.

Returns:
the query source; never null

orderedBy

public Query orderedBy(List<Ordering> orderings)
Create a copy of this query, but one whose results should be ordered by the supplied orderings.

Parameters:
orderings - the result ordering specification that should be used; never null
Returns:
the copy of the query that uses the supplied ordering; never null

returning

public Query returning(List<Column> columns)
Create a copy of this query, but that returns results with the supplied columns.

Parameters:
columns - the columns of the results; may not be null
Returns:
the copy of the query returning the supplied result columns; never null

withLimit

public Query withLimit(int rowLimit)
Create a copy of this query, but one that uses the supplied limit on the number of result rows.

Parameters:
rowLimit - the limit that should be used; must be a positive number
Returns:
the copy of the query that uses the supplied limit; never null

withOffset

public Query withOffset(int offset)
Create a copy of this query, but one that uses the supplied offset.

Parameters:
offset - the limit that should be used; may not be negative
Returns:
the copy of the query that uses the supplied offset; never null

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()

hashCode

public int hashCode()

Overrides:
hashCode in class Object
See Also:
Object.hashCode()


Copyright © 2010 eXo Platform SAS. All Rights Reserved.