Class GroupQueryHandler

  • All Implemented Interfaces:
    JcmsConstants, JaliosConstants

    public class GroupQueryHandler
    extends AbstractQueryHandler<Group>
    Holder class and form handler of all parameters to be used for a query of groups.

    Since:
    jcms-5.7.4
    Version:
    $Revision: 112713 $
    Author:
    Olivier Jaquemet
    • Constructor Detail

      • GroupQueryHandler

        public GroupQueryHandler()
        Constructs a new empty GroupQueryHandler with default option.
        Since:
        jcms-5.7.4
      • GroupQueryHandler

        public GroupQueryHandler​(java.lang.String queryString)
        Constructs a new GroupQueryHandler by parsing the specified query string.

        See GroupQueryHandler(String, HttpServletRequest) for a list of the decoded parameters.

        Parameters:
        queryString - a query String consisting of parameters (key=value) to be set in this handler.
        • Parameters must be separated with ampersand (&).
        • Values must be encoded in UTF-8.
        • Query must not starts with question mark (?) e.g : "groupText=welcome&gid=j_42"
        Since:
        jcms-5.7.4
      • GroupQueryHandler

        public GroupQueryHandler​(java.lang.String queryString,
                                 javax.servlet.http.HttpServletRequest request)
        Constructs a new GroupQueryHandler by parsing the specified query string and using informations available from the specified request (logged member, user language, etc).

        The following parameters (and only those listed here) will be automatically decoded from the specified query string. Other parameters should be set using apropriate setters.

        Parameters:
        queryString - a query String consisting of parameters (key=value) to be set in this handler.
        • Parameters must be separated with ampersand (&).
        • Values must be encoded in UTF-8.
        • Query must not starts with question mark (?) e.g : "groupText=welcome&gid=j_42"
        request - the HttpServletRequest to use to retrieve loggedMember, userLang, userLocale that will be used by this handler, ignored if null.
        Since:
        jcms-5.7.4
    • Method Detail

      • parseQueryStringParam

        protected void parseQueryStringParam​(java.lang.String key,
                                             java.lang.String[] values)
        Description copied from class: AbstractQueryHandler
        Method to be implemented by subclass to decode parameter from queryString.
        Specified by:
        parseQueryStringParam in class AbstractQueryHandler<Group>
        Parameters:
        key - the parameter name, never null nor empty.
        values - the parameter values, NEVER NULL NOR EMPTY. You can safely invoke paramValues[0]
      • printParams

        protected java.lang.String printParams​(AbstractQueryHandler.QueryHandlerPrinter printer)
        Print current QueryHandler params using specified QueryHandlerPrinter.
        Specified by:
        printParams in class AbstractQueryHandler<Group>
        Parameters:
        printer - a QueryHandlerPrinter to use
        Returns:
        a string containing all parameters of this handler printed using specified QueryHandlerPrinter.
        Since:
        jcms-5.7.4
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getResultSet

        public java.util.Set<Group> getResultSet()
        Return results of a query done using this GroupQueryHandler.

        Warning: This method process the query each time it is invoked, therefore do not call it multiple times if you don't need it.

        Returns:
        a new Set containing all Group found by this query.
      • getResultSet

        public java.util.Set<Group> getResultSet​(java.util.Comparator<? super Group> comparator)
        Return results of a query done using this GroupQueryHandler.

        Warning: This method process the query each time it is invoked, therefore do not call it multiple times if you don't need it.

        Parameters:
        comparator - the optional Comparator to sort the return collection
        Returns:
        a new Set containing all Group found by this query, sorted using specified comparator if any.
      • getGroupFilter

        public java.lang.String getGroupFilter()
        Retrieve the current group filter being used by this GroupQueryHandler.
        Returns:
        a string indicating the filter being applied
        Since:
        jcms-5.7.4
        See Also:
        Group.WorkspaceSelector
      • setGroupFilter

        public void setGroupFilter​(java.lang.String groupFilter)
        Define the groupFilter to use in this GroupQueryHandler.
        Parameters:
        groupFilter - a string indicating the filter being applied, see constructor Group.WorkspaceSelector for more information on possible values
      • setWrkspc

        public void setWrkspc​(java.lang.String wsId)
        Sets the Workspace that groups must belong to in order to be found.
        Parameters:
        wsId - an id of Workspace or null to disable filter on Group's Workspace
        Since:
        jcms-7.0.2 jcms-7.1
      • getRefinedWorkspace

        public Workspace getRefinedWorkspace()
        Retrieves the Workspace being used to filter groups in this Query.
        Returns:
        a Workspace or null if no workspace is being used
        Since:
        jcms-5.7.4
      • getGroupText

        public java.lang.String getGroupText()
        Retrieves the text being search in this query
        Returns:
        a string or null if no text is being searched
      • setGroupText

        public void setGroupText​(java.lang.String groupText)
        Set the text to search in Group
        Parameters:
        groupText - any string to look for in Group's name
      • getGid

        public java.lang.String getGid()
        Retrieve the parent group id used by this Query
        Returns:
        an id of Group or null if there is no filter on parent Group
      • setGid

        public void setGid​(java.lang.String parentGid)
        Sets the parent group id to be used during query
        Parameters:
        parentGid - an id of Group or null to disable filter on parent Group
      • getParentGroup

        public Group getParentGroup()
        Retrieves the parent group used by this query, as specified using setGid(String).
        Returns:
        a Group or null if there is no filter on parent Group