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 Details

  • Constructor Details

    • WorkspaceQueryHandler

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

      public WorkspaceQueryHandler(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(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 Details

    • getResults

      public WorkspaceResult getResults()
      Return a WorkspaceResult instance using filters specified in 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 WorkspaceResult, never return null
    • getResultSet

      public 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 Set<Workspace> getResultSet(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 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(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(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 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:
    • setWsModel

      public void setWsModel(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 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:
    • setWsState

      public void setWsState(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 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:
    • getClassificationLevel

      public 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 Set<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(Set<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(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
    • getLogger

      protected org.apache.log4j.Logger getLogger()
      Specified by:
      getLogger in class AbstractQueryHandler<Workspace>
    • parseQueryStringParam

      protected void parseQueryStringParam(String paramName, 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 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 String toString()
      Overrides:
      toString in class Object