Class WorkspaceQueryHandler

  • All Implemented Interfaces:
    JcmsConstants, JaliosConstants

    public class WorkspaceQueryHandler
    extends AbstractQueryHandler<Workspace>
    Search for Workspace, by checking rights, workspace belonging, and testing if member is worker of the workspace. Currently used in topbar and sidebar workspace lists
    Since:
    jcms-10.0.0
    Author:
    Kévin Bransard
    • Field Detail

      • CLASSIFICATION_LEVEL_FILTER_PARAM

        public static final java.lang.String CLASSIFICATION_LEVEL_FILTER_PARAM
        See Also:
        Constant Field Values
    • Constructor Detail

      • WorkspaceQueryHandler

        public WorkspaceQueryHandler()
        Constructs a new empty WorkspaceQueryHandler with default option.
      • WorkspaceQueryHandler

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

        See WorkspaceQueryHandler(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 : "text=welcome&worker=true"
        Since:
        jcms-10.0.4 / JCMS-7924
      • WorkspaceQueryHandler

        public WorkspaceQueryHandler​(java.lang.String queryString,
                                     javax.servlet.http.HttpServletRequest request)
        Constructs a new WorkspaceQueryHandler 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 : "text=welcome&worker=true"
        request - the HttpServletRequest to use to retrieve loggedMember, userLang, userLocale that will be used by this handler, ignored if null.
        Since:
        jcms-10.0.4 / JCMS-7924
    • Method Detail

      • getResultSet

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

        Warning - this method DOES NOT support the following option :

        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 Workspace found by this query.
        Since:
        jcms-10.0.4 / JCMS-7924
      • getResultSet

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

        Warning - this method DOES NOT support the following option :

        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 Workspace found by this query.
        Since:
        jcms-10.0.4 / JCMS-7924
      • getWorkspaceQuery

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

        public void setWorkspaceQuery​(java.lang.String workspaceQuery)
        Set the text to search in Workspace title
        Parameters:
        workspaceQuery - any string to look for in Workspaces
      • isOpSearch

        public boolean isOpSearch()
      • setOpSearch

        public void setOpSearch​(boolean opSearch)
      • isBelongsToWorkspace

        public boolean isBelongsToWorkspace()
      • setBelongsToWorkspace

        public void setBelongsToWorkspace​(boolean belongsToWorkspace)
      • isWorker

        public boolean isWorker()
      • setWorker

        public void setWorker​(boolean worker)
      • isShowModel

        public boolean isShowModel()
        Returns:
        the showModel
      • setShowModel

        public void setShowModel​(boolean showModel)
        Parameters:
        showModel - the showModel to set
      • isWithPortal

        public boolean isWithPortal()
        Returns:
        the withPortal
      • setWithPortal

        public void setWithPortal​(boolean withPortal)
        Parameters:
        withPortal - the withPortal to set
      • setWsType

        public void setWsType​(java.lang.String filter)
        Set the workspace type filter to apply to searched workspace.
        • "all" (default) no filter (except filter defined with other setters)
        • "ws" all but collaborative space
        • "cs" collaborative space only
        Parameters:
        filter -
        Since:
        jcms-10.0.4 / JCMS-7924
      • getWsType

        public java.lang.String getWsType()
        Retrieve workspace type filter applied for this query.
        Returns:
        a string from value authorized in setter
        Since:
        jcms-10.0.4 / JCMS-7924
        See Also:
        setWsType(String)
      • setWsModel

        public void setWsModel​(java.lang.String filter)
        Set the workspace model filter to apply to searched workspace.
        • "all" (default) no filter (except filter defined with other setters)
        • "true" model workspace only
        • "false" all but model workspace
        Parameters:
        filter -
        Since:
        jcms-10.0.4 / JCMS-7924
      • getWsModel

        public java.lang.String getWsModel()
        Retrieve workspace model filter applied for this query.
        Returns:
        a string from value authorized in setter
        Since:
        jcms-10.0.4 / JCMS-7924
        See Also:
        setWsModel(String)
      • setWsState

        public void setWsState​(java.lang.String filter)
        Set the workspace state filter to apply to searched workspace.
        • "all" (default) no filter (except filter defined with other setters)
        • "opened" opened workspace only
        • "closed" closed workspace only
        Parameters:
        filter -
        Since:
        jcms-10.0.4 / JCMS-7924
      • getWsState

        public java.lang.String getWsState()
        Retrieve workspace state filter applied for this query.
        Returns:
        a string from value authorized in setter
        Since:
        jcms-10.0.4 / JCMS-7924
        See Also:
        setWsState(String)
      • getClassificationLevel

        public java.lang.String[] getClassificationLevel()
        Retrieve the classification levels that workspaces must match in order to be found.
        Returns:
        an array of workspace classification level (the string representation of the level int value) or null if there is no filter on Workspace's classification level
        Since:
        10.0.8 / JCMS-10746
      • getClassificationLevelSet

        public java.util.Set<java.lang.Integer> getClassificationLevelSet()
        Retrieve the classification levels that workspaces must match in order to be found.
        Returns:
        a Set of workspace classification levels to match, never return null (an empty set mean there is no filter on Workspace's classification level)
        Since:
        10.0.8 / JCMS-10746
      • setClassificationLevelSet

        public void setClassificationLevelSet​(java.util.Set<java.lang.Integer> levelSet)
        Sets the classification levels that workspace must match in order to be found.
        Parameters:
        levelSet - a Set of workspace classification level, if null or empty, no filter on Workspace's classification level will be applied
        Since:
        10.0.8 / JCMS-10746
      • setClassificationLevel

        public void setClassificationLevel​(java.lang.String... levels)
        Sets the classification levels that workspace must match in order to be found.
        Parameters:
        levels - an array of workspace classification level (the string representation of the level int value) or null if there is no filter on Workspace's classification level
        Since:
        10.0.8 / JCMS-10746
      • showClassification

        public boolean showClassification()
        Check if the classification level field and filter should be displayed to user
        Returns:
        true to display fields and filter, false otherwise
        Since:
        10.0.8 / JCMS-10746
      • parseQueryStringParam

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

        protected java.lang.String printParams​(AbstractQueryHandler.QueryHandlerPrinter printer)
        Description copied from class: AbstractQueryHandler
        Method to be implemented by subclass to provide params printing in query or hidden input format.
        Typical implementation :
         protected String printParams(QueryHandlerPrinter printer) {
           printer.printParam("foo", getFoo());
           printer.printParam("bar", getBar());
           return printer.toString();
         }
         
        Specified by:
        printParams in class AbstractQueryHandler<Workspace>
        Parameters:
        printer - a QueryHandlerPrinter to use
        Returns:
        a string containing all parameters of this handler printed using specified QueryHandlerPrinter.
      • toString

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