org.mmbase.storage.search.implementation
Class ModifiableQuery

java.lang.Object
  extended byorg.mmbase.storage.search.implementation.ModifiableQuery
All Implemented Interfaces:
SearchQuery

public class ModifiableQuery
extends java.lang.Object
implements SearchQuery

A ModifiedQuery enables a modifiable lightweight copy of a SearchQuery to be created by wrapping the original query.

This class is provided primarily for use by core-, security- and storage layer classes, in those rare cases where modifications may be appropriate to a query before processing it.

The ModifiedQuery wraps the original query, and can be modified without affecting the original query. Modifications are not validated, and may lead to inconsistent data in the query (e.g. sorting on fields that are not in the query), resulting in a query that can not be processed by the storage. Avoiding such inconsistencies is the responsibility of the user.

Since:
MMBase-1.7
Version:
$Id: ModifiableQuery.java,v 1.4.2.1 2004/05/07 13:24:14 michiel Exp $
Author:
Rob van Maris

Field Summary
 
Fields inherited from interface org.mmbase.storage.search.SearchQuery
DEFAULT_MAX_NUMBER, DEFAULT_OFFSET
 
Constructor Summary
ModifiableQuery(SearchQuery query)
          Creates a new instance of ModifiedQuery
 
Method Summary
 boolean equals(java.lang.Object obj)
           Should correspond to BasicSearchQuery.equals(java.lang.Object)
 Constraint getConstraint()
          Gets the constraints on the search results.
 java.util.List getFields()
          Gets the stepfields in the search request.
 int getMaxNumber()
          Gets the maximum number of results to be returned, or -1 if the number of results to be returned is unlimited.
 int getOffset()
          Gets the (zerobased) offset in the list of results, of the first result to return.
 java.util.List getSortOrders()
          Gets the SortOrder objects in the order they are to be applied.
 java.util.List getSteps()
          Gets the steps in the search request.
 int hashCode()
           Should correspond to BasicSearchQuery.hashCode()
 boolean isAggregating()
          Tests if this is an aggregating query, i.e.
 boolean isDistinct()
          Tests if the search request is to return distinct results.
 ModifiableQuery setAggregating(java.lang.Boolean aggregating)
          Sets the aggregating property.
 ModifiableQuery setConstraint(Constraint constraint)
          Sets the constraint property.
 ModifiableQuery setDistinct(java.lang.Boolean distinct)
          Sets the distinct property.
 ModifiableQuery setFields(java.util.List fields)
          Sets the fields property.
 ModifiableQuery setMaxNumber(int maxNumber)
          Sets the maxNumber property.
 ModifiableQuery setOffset(int offset)
          Sets the offset property.
 ModifiableQuery setSortOrders(java.util.List sortOrders)
          Sets the sortOrders property.
 ModifiableQuery setSteps(java.util.List steps)
          Sets the steps property.
 java.lang.String toString()
          Returns a string representation of this SearchQuery.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModifiableQuery

public ModifiableQuery(SearchQuery query)
Creates a new instance of ModifiedQuery

Method Detail

setMaxNumber

public ModifiableQuery setMaxNumber(int maxNumber)
Sets the maxNumber property.

Parameters:
maxNumber - The maxNumber value, -1 means: use query.getMaxNumber().
Returns:
This ModifiableQuery instance.

setOffset

public ModifiableQuery setOffset(int offset)
Sets the offset property.

Parameters:
offset - The offset value, -1 means: use query.getOffset().
Returns:
This ModifiableQuery instance.

setConstraint

public ModifiableQuery setConstraint(Constraint constraint)
Sets the constraint property.

Parameters:
constraint - The constraint, null means: use query.getConstraint().
Returns:
This ModifiableQuery instance.

setFields

public ModifiableQuery setFields(java.util.List fields)
Sets the fields property.

Parameters:
fields - The fields, null means: use query.getFields().
Returns:
This ModifiableQuery instance.

setSortOrders

public ModifiableQuery setSortOrders(java.util.List sortOrders)
Sets the sortOrders property.

Parameters:
sortOrders - The sortorders, null means: use query.getSortOrders().
Returns:
This ModifiableQuery instance.

setSteps

public ModifiableQuery setSteps(java.util.List steps)
Sets the steps property.

Parameters:
steps - The steps, null means: use query.getSteps()Returns:
This ModifiableQuery instance.

setDistinct

public ModifiableQuery setDistinct(java.lang.Boolean distinct)
Sets the distinct property.

Parameters:
distinct - The value of the distinct property, null means: use query.isDistinct().
Returns:
This ModifiableQuery instance.

setAggregating

public ModifiableQuery setAggregating(java.lang.Boolean aggregating)
Sets the aggregating property.

Parameters:
aggregating - The value of the aggregating property, null means: use query.isAggregating().
Returns:
This ModifiableQuery instance.

getMaxNumber

public int getMaxNumber()
Description copied from interface: SearchQuery
Gets the maximum number of results to be returned, or -1 if the number of results to be returned is unlimited.

Note: limiting the number of results may not be supported by the database layer.

Specified by:
getMaxNumber in interface SearchQuery

getOffset

public int getOffset()
Description copied from interface: SearchQuery
Gets the (zerobased) offset in the list of results, of the first result to return. Note that, since it is zerobased, it is equal to the number of results that are skipped.

Note: skipping results may not be supported by the database layer.

Specified by:
getOffset in interface SearchQuery

getConstraint

public Constraint getConstraint()
Description copied from interface: SearchQuery
Gets the constraints on the search results.

This corresponds to (part of) the constraints in the WHERE-clause in SQL SELECT-syntax.

Specified by:
getConstraint in interface SearchQuery

getFields

public java.util.List getFields()
Description copied from interface: SearchQuery
Gets the stepfields in the search request.

This corresponds to the fields in SQL SELECT-syntax.

Specified by:
getFields in interface SearchQuery

getSortOrders

public java.util.List getSortOrders()
Description copied from interface: SearchQuery
Gets the SortOrder objects in the order they are to be applied. This specifies the sorting order of the search results.

This corresponds to the ORDER BY clause in SQL SELECT syntax.

Specified by:
getSortOrders in interface SearchQuery

getSteps

public java.util.List getSteps()
Description copied from interface: SearchQuery
Gets the steps in the search request.

This corresponds to the tables in SQL SELECT-syntax.

Specified by:
getSteps in interface SearchQuery

isDistinct

public boolean isDistinct()
Description copied from interface: SearchQuery
Tests if the search request is to return distinct results. In that case duplicate nodes will be removed from the result.

This corresponds to the use of "DISTINCT" in SQL SELECT-syntax .

Specified by:
isDistinct in interface SearchQuery

isAggregating

public boolean isAggregating()
Description copied from interface: SearchQuery
Tests if this is an aggregating query, i.e. containing aggregated fields.

Specified by:
isAggregating in interface SearchQuery

equals

public boolean equals(java.lang.Object obj)
Should correspond to BasicSearchQuery.equals(java.lang.Object)

Specified by:
equals in interface SearchQuery

hashCode

public int hashCode()
Should correspond to BasicSearchQuery.hashCode()

Specified by:
hashCode in interface SearchQuery

toString

public java.lang.String toString()
Description copied from interface: SearchQuery
Returns a string representation of this SearchQuery. The string representation has the form "SearchQuery(distinct:<distinct>, steps:<steps>, fields:<fields>, constraint:<constraint>, sortorders:<sortorders>, max:<max>, offset:<offset>)" where

Specified by:
toString in interface SearchQuery


MMBase build 1.7.1.20041002