com.jalios.jcms
Class QueryFilter

java.lang.Object
  extended by com.jalios.jcms.QueryFilter
All Implemented Interfaces:
PluginComponent, Comparable
Direct Known Subclasses:
MailThreadQueryFilter, SpellSuggestEngine

public abstract class QueryFilter
extends Object
implements PluginComponent, Comparable

A QueryFilter is notified for each query.

Since:
jcms-5.0.0
Version:
$Revision: 28011 $
Author:
Olivier Dedieu

Field Summary
static String BACKOFFICE_SEARCH
          QueryHandler attribute used to indicate that we are processing a back office search.
static String FRONTOFFICE_SEARCH
          QueryHandler attribute used to indicate that we are processing a front office search.
protected  int order
           
static String PORTLET_QUERY
          QueryHandler attribute used to indicate that we are processing a portlet's query.
static String REVISION
           
 
Constructor Summary
QueryFilter()
          Constructs a QueryFilter with order = 0
QueryFilter(int order)
          Constructs a QueryFilter with the given order
 
Method Summary
 int compareTo(Object obj)
          Compare this object with the specified object for order.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 QueryHandler filterQueryHandler(QueryHandler qh, Map context)
          This method should be overriden to filter the value of the QueryHandler
 QueryResultSet filterResultSet(QueryHandler qh, QueryResultSet set, Map context)
          This method should be overriden to filter the result set
 boolean getSearchDefault()
          This method may overriden if this QueryFilter is selectable from the search user interface.
 String getSearchDescription(String lang)
          This method may be overriden if this QueryFilter is selectable from the search user interface.
 String getSearchLabel(String lang)
          This method may be overriden if this QueryFilter is selectable from the search user interface.
 String getSearchParam()
          This method must be overriden if this QueryFilter is selectable from the search user interface.
 boolean init(Plugin plugin)
          Initialize the component with the given plugin configuration
static boolean isBackOfficeSearch(QueryHandler qh)
          Check if the specified QueryHandler is a back office search.
static boolean isFrontOfficeSearch(QueryHandler qh)
          Check if the specified QueryHandler is a front office search.
static boolean isPortletQuery(QueryHandler qh)
          Check if the specified QueryHandler is a portlet query.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

FRONTOFFICE_SEARCH

public static final String FRONTOFFICE_SEARCH
QueryHandler attribute used to indicate that we are processing a front office search.
Do not directly read this attribute, use method isFrontOfficeSearch(QueryHandler).


BACKOFFICE_SEARCH

public static final String BACKOFFICE_SEARCH
QueryHandler attribute used to indicate that we are processing a back office search.
Do not directly read this attribute, use method isBackOfficeSearch(QueryHandler).


PORTLET_QUERY

public static final String PORTLET_QUERY
QueryHandler attribute used to indicate that we are processing a portlet's query.
Do not directly read this attribute, use method isPortletQuery(QueryHandler).


order

protected int order
Constructor Detail

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 Detail

init

public boolean init(Plugin plugin)
Description copied from interface: PluginComponent
Initialize the component with the given plugin configuration

Specified by:
init in interface PluginComponent
Parameters:
plugin - the calling plugin
Returns:
true if the component has been correctly initialized.
Since:
jcms-5.7.2
See Also:
PluginComponent.init(Plugin)

filterQueryHandler

public QueryHandler filterQueryHandler(QueryHandler qh,
                                       Map context)
This method should be overriden to filter the value of the QueryHandler

Parameters:
qh - the QueryHandler
context - the context. Can be used to exchange data between custom QueryFilters.
Returns:
the (filtered) QueryHandler
Since:
jcms-5.0.0

filterResultSet

public QueryResultSet filterResultSet(QueryHandler qh,
                                      QueryResultSet set,
                                      Map context)
This method should be overriden to filter the result set

Parameters:
qh - the QueryHandler
set - the result set
context - the context. Can be used to exchange data between custom QueryFilters.
Returns:
the (filtered) result set
Since:
jcms-5.0.0

getSearchParam

public String 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

public String getSearchLabel(String lang)
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

public String getSearchDescription(String lang)
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

public int compareTo(Object obj)
Compare this object with the specified object for order.

Specified by:
compareTo in interface Comparable
Parameters:
obj - the Object to be compared.
See Also:
Comparable.compareTo(java.lang.Object)

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one. The comparison is performed with compareTo() method.

Overrides:
equals in class Object
Parameters:
obj - the Object to be compared.

isFrontOfficeSearch

public static boolean isFrontOfficeSearch(QueryHandler qh)
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.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

public static boolean isBackOfficeSearch(QueryHandler qh)
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

public static boolean isPortletQuery(QueryHandler qh)
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.jsp".

Parameters:
qh - the QueryHandler to check
Returns:
true if the query being filtered is a portlet's query, false for any other query.


Copyright © 2001-2010 Jalios SA. All Rights Reserved.