org.equanda.persistence.query
Class EquandaQueryImpl

java.lang.Object
  extended by org.equanda.persistence.query.EquandaQueryImpl
All Implemented Interfaces:
Serializable, EquandaQuery

public class EquandaQueryImpl
extends Object
implements EquandaQuery

A basic implementation for the EquandaQuery.

Author:
NetRom team
See Also:
Serialized Form

Constructor Summary
EquandaQueryImpl()
           
EquandaQueryImpl(String queryString)
           
EquandaQueryImpl(String queryString, String countQueryString)
           
 
Method Summary
 void addExtra(String name, Object value)
          Allows adding extra parameters which can be cleared from the query.
 void clearExtra()
          Clear the extra parameters
 String getCountQueryString()
           
 int getFirstResult()
          Gives the starting results index.
 int getMaxResults()
          Gives the maximum number of results.
 Map<String,Object> getParameters()
           
 String getQueryString()
           
 ObjectType getTypeFilter()
          This will be used as a filter(@see isParentType()).
 boolean hasCountQuery()
           
protected  void init(String queryStr, int maxRes, int firstRes, String countQueryStr, Map<String,Object> params)
           
 EquandaQueryImpl setCountQueryString(String countQueryStr)
           
 EquandaQuery setFirstResult(int firstRes)
          Sets the starting results index.
 EquandaQuery setMaxResults(int maxRes)
          Sets the maximum number of results.
 EquandaQueryImpl setParameter(String name, Object value)
          Add one parameter (would have been more logical to call this "addParameter", but this is more in line with the AJPA/Hibernate Query interface).
 EquandaQueryImpl setParameters(Map<String,Object> parameters)
          Add a list of parameters
 EquandaQueryImpl setQueryString(String queryStr)
           
 EquandaQuery setTypeFilter(ObjectType newValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EquandaQueryImpl

public EquandaQueryImpl()

EquandaQueryImpl

public EquandaQueryImpl(String queryString)

EquandaQueryImpl

public EquandaQueryImpl(String queryString,
                        String countQueryString)
Method Detail

init

protected void init(String queryStr,
                    int maxRes,
                    int firstRes,
                    String countQueryStr,
                    Map<String,Object> params)

getQueryString

public String getQueryString()
Specified by:
getQueryString in interface EquandaQuery
Returns:
the query string to be used.

getCountQueryString

public String getCountQueryString()
Specified by:
getCountQueryString in interface EquandaQuery
Returns:
the count query to be used.

setQueryString

public EquandaQueryImpl setQueryString(String queryStr)

setCountQueryString

public EquandaQueryImpl setCountQueryString(String countQueryStr)

hasCountQuery

public boolean hasCountQuery()

getMaxResults

public int getMaxResults()
Description copied from interface: EquandaQuery
Gives the maximum number of results. If a value <=0 then it will be ignored.

Specified by:
getMaxResults in interface EquandaQuery
Returns:
the maximum number of results.

setMaxResults

public EquandaQuery setMaxResults(int maxRes)
Description copied from interface: EquandaQuery
Sets the maximum number of results. If a value lt;=0 then it will be ignored.

Specified by:
setMaxResults in interface EquandaQuery
Parameters:
maxRes - max number of results
Returns:
the EquandaQuery object.

getFirstResult

public int getFirstResult()
Description copied from interface: EquandaQuery
Gives the starting results index. If a value <0 then it will be ignored.

Specified by:
getFirstResult in interface EquandaQuery
Returns:
the starting results index.

setFirstResult

public EquandaQuery setFirstResult(int firstRes)
Description copied from interface: EquandaQuery
Sets the starting results index. If a value <0 then it will be ignored.

Specified by:
setFirstResult in interface EquandaQuery
Parameters:
firstRes - number of first record which needs to be fetched
Returns:
the starting results index.

getParameters

public Map<String,Object> getParameters()
Specified by:
getParameters in interface EquandaQuery
Returns:
the parameters for this query

setParameters

public EquandaQueryImpl setParameters(Map<String,Object> parameters)
Description copied from interface: EquandaQuery
Add a list of parameters

Specified by:
setParameters in interface EquandaQuery
Parameters:
parameters - parameters nam/value pairs
Returns:
query object itself

setParameter

public EquandaQueryImpl setParameter(String name,
                                     Object value)
Description copied from interface: EquandaQuery
Add one parameter (would have been more logical to call this "addParameter", but this is more in line with the AJPA/Hibernate Query interface).

Specified by:
setParameter in interface EquandaQuery
Parameters:
name - parameter name
value - parameter value
Returns:
query object itself

getTypeFilter

public ObjectType getTypeFilter()
Description copied from interface: EquandaQuery
This will be used as a filter(@see isParentType()). If this returns null no filtering is done.

Specified by:
getTypeFilter in interface EquandaQuery
Returns:
an ObjectType

setTypeFilter

public EquandaQuery setTypeFilter(ObjectType newValue)
Specified by:
setTypeFilter in interface EquandaQuery

addExtra

public void addExtra(String name,
                     Object value)
Description copied from interface: EquandaQuery
Allows adding extra parameters which can be cleared from the query. This is used internally for adding the parameters to the filters.

Specified by:
addExtra in interface EquandaQuery
Parameters:
name - extra parameter name
value - extra parameter value

clearExtra

public void clearExtra()
Description copied from interface: EquandaQuery
Clear the extra parameters

Specified by:
clearExtra in interface EquandaQuery


Copyright © 2007-2009. All Rights Reserved.