org.hippoecm.hst.content.beans.query
Interface HstQuery

All Known Implementing Classes:
HstQueryImpl

public interface HstQuery


Field Summary
static int DEFAULT_LIMIT
          The default limit that is used for a HstQuery.
 
Method Summary
 void addOrderByAscending(String fieldNameAttribute)
          Order the object found (ascending)
 void addOrderByDescending(String fieldNameAttribute)
          Order the object found (descending)
 void addScopes(List<HippoBean> scopes)
          add scopes to search in.
 void addScopes(javax.jcr.Node[] scopes)
          add scopes to search in.
 Filter createFilter()
           
 void excludeScopes(List<HippoBean> scopes)
          add scopes to exclude from search.
 void excludeScopes(javax.jcr.Node[] scopes)
          add scopes to exclude from search.
 HstQueryResult execute()
          The actual execution of the HstQuery.
 BaseFilter getFilter()
           
 int getLimit()
          Returns the limit of the HstQuery.
 int getOffset()
          Returns the offset of the HstQuery.
 String getQueryAsString(boolean skipDefaultOrderBy)
          Returns the query as string.
 void setFilter(BaseFilter filter)
           
 void setLimit(int limit)
          Sets the limit of search results.
 void setOffset(int offset)
          Sets the offset to start searching from.
 void setSkipInvalidScopes(boolean skipInvalidScopes)
          Whether invalid scopes should be skipped, or if an invalid scope is found (jcr node is null, HippoBean is empty, etc), throw a QueryException.
 

Field Detail

DEFAULT_LIMIT

static final int DEFAULT_LIMIT
The default limit that is used for a HstQuery. Use setLimit(int) if you need to override this value.

See Also:
Constant Field Values
Method Detail

setFilter

void setFilter(BaseFilter filter)

getFilter

BaseFilter getFilter()

createFilter

Filter createFilter()
Returns:
a new empty Filter

setLimit

void setLimit(int limit)
Sets the limit of search results. Note that setting this value very high might influence performance negatively

Parameters:
limit -

getQueryAsString

String getQueryAsString(boolean skipDefaultOrderBy)
                        throws QueryException
Returns the query as string. When skipDefaultOrder is TRUE, the string representation will only include an 'order by' clause when there is set one explicitly.

Parameters:
skipDefaultOrderBy -
Returns:
the query as string
Throws:
QueryException - if we cannot build the query string

getLimit

int getLimit()
Returns the limit of the HstQuery. If no limit is set, it returns the default HstQuery limit DEFAULT_LIMIT

Returns:
the limit

setOffset

void setOffset(int offset)
Sets the offset to start searching from. Default offset is -1 which means it is ignored. A negative offset will be ignored

Parameters:
offset -

getOffset

int getOffset()
Returns the offset of the HstQuery. If no offset is set through setOffset(int), the offset will be -1 and will be ignored

Returns:
the offset

addOrderByAscending

void addOrderByAscending(String fieldNameAttribute)
Order the object found (ascending)

Parameters:
fieldNameAttribute - the name of the field used to sort the search result

addOrderByDescending

void addOrderByDescending(String fieldNameAttribute)
Order the object found (descending)

Parameters:
fieldNameAttribute - the name of the field used to sort the search result

addScopes

void addScopes(List<HippoBean> scopes)
add scopes to search in. If the exact scope is already added to exclude from the search, it is removed from the excluded list.

Parameters:
scopes -

addScopes

void addScopes(javax.jcr.Node[] scopes)
add scopes to search in. If the exact scope is already added to exclude from the search, it is removed from the excluded list.

Parameters:
scopes -

excludeScopes

void excludeScopes(List<HippoBean> scopes)
add scopes to exclude from search. If the exact scope is already added as a scope to search in, it is removed from there

Parameters:
scopes -

excludeScopes

void excludeScopes(javax.jcr.Node[] scopes)
add scopes to exclude from search. If the exact scope is already added as a scope to search in, it is removed from there

Parameters:
scopes -

setSkipInvalidScopes

void setSkipInvalidScopes(boolean skipInvalidScopes)
Whether invalid scopes should be skipped, or if an invalid scope is found (jcr node is null, HippoBean is empty, etc), throw a QueryException. Default HstQuery implementation throw a QueryException when an invalid scope is encountered. If skipInvalid is set to true, then still, when all scopes happen to be invalid, a QueryException is thrown

Parameters:
skipInvalidScopes - is true, invalid scopes are ignored

execute

HstQueryResult execute()
                       throws QueryException
The actual execution of the HstQuery. The HstQueryResult will never contain one and the same result twice. So, if a result matches the search criteria twice, it is still returned as one hit.

Returns:
HstQueryResult
Throws:
QueryException


Copyright © 2008-2012 Hippo. All Rights Reserved.