org.kuali.rice.core.api.criteria
Class QueryByCriteria

java.lang.Object
  extended by org.kuali.rice.core.api.criteria.QueryByCriteria
All Implemented Interfaces:
Serializable, ModelObjectBasic, ModelObjectComplete

public final class QueryByCriteria
extends Object
implements ModelObjectComplete

Defines a criteria-based query. Consists of a Predicate definition as well as a set of additional properties which control paging and other aspects of the results which should be returned from the query.

In order to construct a new QueryByCriteria, the QueryByCriteria.Builder should be used. Use the PredicateFactory to construct the predicate for use by the query.

This class specifies nothing regarding how the query will be executed. It is expected that an instance will be constructed and then passed to code which understands how to execute the desired query.

This class is mapped for use by JAXB and can therefore be used by clients as part of remotable service definitions.

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
Predicate, PredicateFactory, Serialized Form

Nested Class Summary
static class QueryByCriteria.Builder
           
(package private) static class QueryByCriteria.Constants
          Defines some internal constants used on this class.
(package private) static class QueryByCriteria.Elements
          A private class which exposes constants which define the XML element names to use when this object is marshaled to XML.
 
Field Summary
private  Collection<Element> _futureElements
           
private  String countFlag
           
private  Integer maxResults
           
private  Predicate predicate
           
private static long serialVersionUID
           
private  Integer startAtIndex
           
 
Constructor Summary
private QueryByCriteria()
           
private QueryByCriteria(QueryByCriteria.Builder builder)
           
 
Method Summary
 boolean equals(Object obj)
          All "Complete" model object's should adhere to the ModelObjectComplete.equals(Object) contract.
 CountFlag getCountFlag()
          Indicates whether or not a total row count should be returned with the query.
 Integer getMaxResults()
          Returns the maximum number of results that this query is requesting to receive.
 Predicate getPredicate()
          Returns the Predicate which will be used to execute the query.
 Integer getStartAtIndex()
          Returns the optional zero-based "start" index for rows returned.
 int hashCode()
          All "Complete" model object's should adhere to the ModelObjectComplete.hashCode() contract.
 String toString()
          This will return a proper string representation of the Model Object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

predicate

private final Predicate predicate

startAtIndex

private final Integer startAtIndex

maxResults

private final Integer maxResults

countFlag

private final String countFlag

_futureElements

private final Collection<Element> _futureElements
Constructor Detail

QueryByCriteria

private QueryByCriteria()

QueryByCriteria

private QueryByCriteria(QueryByCriteria.Builder builder)
Method Detail

getPredicate

public Predicate getPredicate()
Returns the Predicate which will be used to execute the query.

Returns:
can be null if no predicate was specified

getStartAtIndex

public Integer getStartAtIndex()
Returns the optional zero-based "start" index for rows returned. When this query is executed, this property should be read to determine the first row which should be returned. If the given index is beyond the end of the result set, then the resulting query should effectively return no rows (as opposed to producing an index-based out of bounds error). If the value is null, then the results should start with the first row returned from the query.

Will never be less than 0

Returns:
the starting row index requested by this query, or null if the results should start at the beginning of the result set

getMaxResults

public Integer getMaxResults()
Returns the maximum number of results that this query is requesting to receive. If null, then the query should return all rows, or as many as it can. If the number request is larger than the number of results then all results are returned.

Will never be less than 0

Returns:
the maximum number of results to return from the query

getCountFlag

public CountFlag getCountFlag()
Indicates whether or not a total row count should be returned with the query. See CountFlag for more information on what each of these flags means. This will never return null and defaults to CountFlag.NONE.

Returns:
the flag specifying whether or not a total row count should be produced by the query

hashCode

public int hashCode()
Description copied from interface: ModelObjectComplete
All "Complete" model object's should adhere to the ModelObjectComplete.hashCode() contract.

Specified by:
hashCode in interface ModelObjectComplete
Overrides:
hashCode in class Object
Returns:
the hashCode value

equals

public boolean equals(Object obj)
Description copied from interface: ModelObjectComplete
All "Complete" model object's should adhere to the ModelObjectComplete.equals(Object) contract.

Specified by:
equals in interface ModelObjectComplete
Overrides:
equals in class Object
Parameters:
obj - to object to compare for equality
Returns:
if equal

toString

public String toString()
Description copied from interface: ModelObjectBasic
This will return a proper string representation of the Model Object. All of the fields comprising the "public" api should be represented in the return value.

Specified by:
toString in interface ModelObjectBasic
Overrides:
toString in class Object
Returns:
the string representation


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.