Package com.jalios.jcms
Class QueryFilter
java.lang.Object
com.jalios.jcms.QueryFilter
- All Implemented Interfaces:
PluginComponent,Comparable
- Direct Known Subclasses:
ContentQueryFilter,MailThreadQueryFilter,MediaQueryFilter,SpellSuggestEngine
A QueryFilter is notified for each query.
- Since:
- jcms-5.0.0
- Author:
- Olivier Dedieu
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringQueryHandler attribute used to indicate that we are processing a back office search.static final StringQueryHandler attribute used to indicate that we are processing a front office search.protected intstatic final StringQueryHandler attribute used to indicate that we are processing a portlet's query. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a QueryFilter with order = 0QueryFilter(int order) Constructs a QueryFilter with the given order -
Method Summary
Modifier and TypeMethodDescriptionbooleancallFilterDBResult(PublicationCriteria pubCriteria) Returns true if the methodfilterDBResult(Publication, Map)must be called during a DB query search.booleancallFilterDBResult(Class clazz, Map<String, Object> context) This convenient method is a simplfied version ofcallFilterDBResult(PublicationCriteria).intCompare this object with the specified object for order.booleanIndicates whether some other object is "equal to" this one.voidfilterCriteria(PublicationCriteria pubCriteria, org.hibernate.Criteria criteria) This method should be overriden to modify the Hibernate Criteria used for a DB Query.booleanfilterDBResult(Publication pub, Map<String, Object> context) This method should be overriden to filter DB results.filterQueryHandler(QueryHandler qh, Map context) This method should be overriden to filter the value of the QueryHandlerfilterResultSet(QueryHandler qh, QueryResultSet set, Map context) This method should be overriden to filter the result setintgetOrder()Retrieve the order value used to sort QueryFilter.booleanThis method may overriden if this QueryFilter is selectable from the search user interface.getSearchDescription(String lang) This method may be overriden if this QueryFilter is selectable from the search user interface.getSearchLabel(String lang) This method may be overriden if this QueryFilter is selectable from the search user interface.This method must be overriden if this QueryFilter is selectable from the search user interface.booleanInitialize the component with the given plugin configurationstatic booleanCheck if the specified QueryHandler is a back office search.static booleanCheck if the specified QueryHandler is a front office search.static booleanCheck if the specified QueryHandler is a portlet query.
-
Field Details
-
FRONTOFFICE_SEARCH
QueryHandler attribute used to indicate that we are processing a front office search.
Do not directly read this attribute, use methodisFrontOfficeSearch(QueryHandler). -
BACKOFFICE_SEARCH
QueryHandler attribute used to indicate that we are processing a back office search.
Do not directly read this attribute, use methodisBackOfficeSearch(QueryHandler). -
PORTLET_QUERY
QueryHandler attribute used to indicate that we are processing a portlet's query.
Do not directly read this attribute, use methodisPortletQuery(QueryHandler). -
order
protected int order
-
-
Constructor Details
-
QueryFilter
public QueryFilter()Constructs a QueryFilter with order = 0- Since:
- jcms-5.0.0
-
QueryFilter
public QueryFilter(int order) Constructs a QueryFilter with the given order- Parameters:
order- the order- Since:
- jcms-5.5.0
-
-
Method Details
-
init
Description copied from interface:PluginComponentInitialize the component with the given plugin configuration- Specified by:
initin interfacePluginComponent- Parameters:
plugin- the calling plugin- Returns:
- true if the component has been correctly initialized.
- Since:
- jcms-5.7.2
- See Also:
-
filterQueryHandler
This method should be overriden to filter the value of the QueryHandler- Parameters:
qh- the QueryHandlercontext- the context. Can be used to exchange data between custom QueryFilters.- Returns:
- the (filtered) QueryHandler
- Since:
- jcms-5.0.0
-
filterResultSet
This method should be overriden to filter the result set- Parameters:
qh- the QueryHandlerset- the result setcontext- the context. Can be used to exchange data between custom QueryFilters.- Returns:
- the (filtered) result set
- Since:
- jcms-5.0.0
-
filterCriteria
This method should be overriden to modify the Hibernate Criteria used for a DB Query.- Parameters:
pubCriteria- the criteria of the query.criteria- the hibernate criteria computed by JPlatform core- Since:
- jcms-10.0.7 / JCMS-9561
-
filterDBResult
This method should be overriden to filter DB results.- Parameters:
pub- a DB Publicationcontext- the context used during the query- Returns:
- true if the results must be kept and false if it must be ignored.
- Since:
- jcms-10.0.0
-
callFilterDBResult
Returns true if the methodfilterDBResult(Publication, Map)must be called during a DB query search.- Parameters:
pubCriteria- the criteria of the query.- Returns:
- true if the method
filterDBResult(Publication, Map)must be called during a DB query search. - Since:
- jcms-10.0.0
-
callFilterDBResult
This convenient method is a simplfied version ofcallFilterDBResult(PublicationCriteria).- Parameters:
clazz- the classcontext- a context map.- Returns:
- true if the method
filterDBResult(Publication, Map)must be called during a DB query search. - Since:
- jcms-10.0.0
-
getSearchParam
This method must be overriden if this QueryFilter is selectable from the search user interface.- Returns:
- the name of the http query parameter
- Since:
- jcms-5.5.0
-
getSearchLabel
This method may be overriden if this QueryFilter is selectable from the search user interface.- Parameters:
lang- the user language- Returns:
- the label of the QueryFilter
- Since:
- jcms-5.5.0
-
getSearchDescription
This method may be overriden if this QueryFilter is selectable from the search user interface.- Parameters:
lang- the user language- Returns:
- the description of the QueryFilter
- Since:
- jcms-5.5.0
-
getSearchDefault
public boolean getSearchDefault()This method may overriden if this QueryFilter is selectable from the search user interface.- Returns:
- true if the query filter must be selected by default, false otherwise
- Since:
- jcms-5.5.0
-
compareTo
Compare this object with the specified object for order.- Specified by:
compareToin interfaceComparable- Parameters:
obj- the Object to be compared.- See Also:
-
equals
Indicates whether some other object is "equal to" this one. The comparison is performed with compareTo() method. -
getOrder
public int getOrder()Retrieve the order value used to sort QueryFilter.- Returns:
- an integer value, default is 0
- Since:
- jcms-7.1
-
isFrontOfficeSearch
Check if the specified QueryHandler is a front office search.
Check if the current call to this filter is being processed for a front office search.
In the current implementation, it indicates that this query has been processed through"front/query/query.jsp".- Parameters:
qh- the QueryHandler to check- Returns:
- true if the query being filtered is a front office search, false for any other query.
-
isBackOfficeSearch
Check if the specified QueryHandler is a back office search.
In the current implementation, it indicates that this query has been processed through"work/queryWork.jsp".- Parameters:
qh- the QueryHandler to check- Returns:
- true if the query being filtered is a back office search, false for any other query.
-
isPortletQuery
Check if the specified QueryHandler is a portlet query.
In the current implementation, it indicates that this query has been processed through"types/PortletQueryForeach/doQuery.jspf".- Parameters:
qh- the QueryHandler to check- Returns:
- true if the query being filtered is a portlet's query, false for any other query.
-