Class QueryFilter

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BACKOFFICE_SEARCH
      QueryHandler attribute used to indicate that we are processing a back office search.
      static java.lang.String FRONTOFFICE_SEARCH
      QueryHandler attribute used to indicate that we are processing a front office search.
      protected int order  
      static java.lang.String PORTLET_QUERY
      QueryHandler attribute used to indicate that we are processing a portlet's query.
      static java.lang.String REVISION  
    • Constructor Summary

      Constructors 
      Constructor Description
      QueryFilter()
      Constructs a QueryFilter with order = 0
      QueryFilter​(int order)
      Constructs a QueryFilter with the given order
    • Field Detail

      • FRONTOFFICE_SEARCH

        public static final java.lang.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 java.lang.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 java.lang.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,
                                               java.util.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,
                                              java.util.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
      • filterCriteria

        public void filterCriteria​(PublicationCriteria pubCriteria,
                                   org.hibernate.Criteria criteria)
        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

        public boolean filterDBResult​(Publication pub,
                                      java.util.Map<java.lang.String,​java.lang.Object> context)
        This method should be overriden to filter DB results.
        Parameters:
        pub - a DB Publication
        context - 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

        public boolean callFilterDBResult​(java.lang.Class clazz,
                                          java.util.Map<java.lang.String,​java.lang.Object> context)
        This convenient method is a simplfied version of callFilterDBResult(PublicationCriteria).
        Parameters:
        clazz - the class
        context - 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

        public java.lang.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 java.lang.String getSearchLabel​(java.lang.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 java.lang.String getSearchDescription​(java.lang.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​(java.lang.Object obj)
        Compare this object with the specified object for order.
        Specified by:
        compareTo in interface java.lang.Comparable
        Parameters:
        obj - the Object to be compared.
        See Also:
        Comparable.compareTo(java.lang.Object)
      • equals

        public boolean equals​(java.lang.Object obj)
        Indicates whether some other object is "equal to" this one. The comparison is performed with compareTo() method.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the Object to be compared.
      • getOrder

        public int getOrder()
        Retrieve the order value used to sort QueryFilter.
        Returns:
        an integer value, default is 0
        Since:
        jcms-7.1
      • 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.jspf".
        Parameters:
        qh - the QueryHandler to check
        Returns:
        true if the query being filtered is a portlet's query, false for any other query.