Class QueryHandler

All Implemented Interfaces:
JcmsConstants, JaliosConstants
Direct Known Subclasses:
PortletQueryForeachQueryHandler, PubChooserHandler, QueryAppHandler, WebPageQueryHandler

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

There is two main use cases :

  • in a jsp, as a java bean form handler (such as in search.jsp or refine.jsp).
    The QueryHandler is instanciated with the request property which initializes the bean exactly like a JcmsJspContext instance, with all contextual informations (specially the logged member). Therefore the query will be performed using access right of the loggedMember accessing the JSP.
     <jsp:useBean id="myQueryHandler" scope="page" class="com.jalios.jcms.handler.QueryHandler">
     <jsp:setProperty name="myQueryHandler" property="request" value="<%= request %>"/>
     <jsp:setProperty name="myQueryHandler" property="*" />
     </jsp:useBean>
     <% Set<Publication> resultSet = myQueryHandler.getResultSet(); %>
     
  • in a jsp or in java, as a parameter holder, using default constructor and proper setters.
    When used a POJO, all parameters must be defined manually, specially, if access right verification is required do not forget to specify the loggedMember to use to perform the query.
     QueryHandler myQH = new QueryHandler();
     myQH.setLoggedMember( someMember ); // optional Member to be used for access right check
     myQH.setTypes(Article.class.getName());
     myQH.setText("hello");
     Set<Publication> helloArticleSet = myQH.getResultSet();
     

If you need to perform a custom query in a jsp, use the jsp tag <jalios:query ... /> which delegates to this class and performs all the processing needed.

  • Field Details

    • TEXT_MODE_ALL_WORDS

      public static final String TEXT_MODE_ALL_WORDS
      The mode value to use to perform a text search matching all the words of the search string.
      Value : "all".
      Since:
      jcms-5.6.2
      See Also:
    • TEXT_MODE_ANY_WORD

      public static final String TEXT_MODE_ANY_WORD
      The mode value to use to perform a text search matching at least one of the words of the search string.
      Value : "any".
      Since:
      jcms-5.6.2
      See Also:
    • TEXT_MODE_EXACT

      public static final String TEXT_MODE_EXACT
      The mode value to use to perform a text search matching the exact phrase specified in the search string.
      Value : "exact".
      Since:
      jcms-5.6.2
      See Also:
    • TEXT_MODE_ADVANCED

      public static final String TEXT_MODE_ADVANCED
      The mode value to use to perform a text search with advanced search syntax (wildcard, field, etc).
      Value : "advanced".
      Since:
      jcms-5.6.2
      See Also:
    • CLASSIFICATION_LEVEL_FILTER_PARAM

      public static final String CLASSIFICATION_LEVEL_FILTER_PARAM
      See Also:
  • Constructor Details

  • Method Details

    • getLogger

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

      protected void parseQueryStringParam(String key, String[] values)
      Description copied from class: AbstractQueryHandler
      Method to be implemented by subclass to decode parameter from queryString.
      Specified by:
      parseQueryStringParam in class AbstractQueryHandler<Publication>
      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 String printParams(AbstractQueryHandler.QueryHandlerPrinter printer)
      Print current QueryHandler params using specified QueryHandlerPrinter.
      Specified by:
      printParams in class AbstractQueryHandler<Publication>
      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 String toString()
      Overrides:
      toString in class Object
    • getResultSet

      public QueryResultSet getResultSet()
      Return results of a query done using this QueryHandler.

      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 QueryResultSet containing all results of this query, it is a HashSet and therefore it is NOT sorted. use either getAsSortedSet() or getAsSortedSet(Comparator) to obtain a sorted Set.
      Since:
      jcms-5.0.0
    • getCategorySet

      public Set<Category> getCategorySet(String inputName)
    • isExpanded

      public boolean isExpanded(Category cat, String inputName)
    • setIgnoreDefaultTypes

      public void setIgnoreDefaultTypes(boolean ignoreDefaultTypes)
      Parameters:
      ignoreDefaultTypes - if true, getTypes() and getTypesOff() won't check the properties for default query types and types off.
      Since:
      jcms-5.0.0
    • getRefinedWorkspace

      public Workspace getRefinedWorkspace()
      Get the Workspace for this request.
      Returns:
      a Workspace
    • getWorkspaceSet

      public Set<Workspace> getWorkspaceSet()
      Retrieve the Set of Workspace on which the query was initially refined.
      Returns:
      a Set of Workspace. Return an empty set when searching in all workspace or in logged member workspace, never return null.
      Since:
      jcms-7.1.3, jcms-8.0.0, JCMS-3331
    • getResolvedWorkspaceSet

      public Set<Workspace> getResolvedWorkspaceSet()
      Retrieve the Set of Workspace on which the query is refined.

      This set is computed :

      Returns:
      a Set of Workspace. Return an empty set when searching in all workspace, never return null.
      Since:
      jcms-7.1.3, jcms-8.0.0, JCMS-3331
    • setWs

      public void setWs(String wsId)
      Overrides:
      setWs in class JcmsFormHandler
    • setWrkspc

      public void setWrkspc(String... wsIds)
      Set the workspaces ids that publication must belong.

      This method also accepts the unique "user" value to trigger a search in the workspaces the logged member belong (cf improvement JCMS-4857).

      Default behavior of query handler is to search in all workspaces.

      This method is exclusive with setWs(String), setWorkspace(Workspace) and setWorkspaceSet(Set).

      Parameters:
      wsIds - one or several ids of Workspace, unique value "user" to search in logged member workspaces, or null/empty values to search in all workspaces
      See Also:
    • setWorkspace

      public void setWorkspace(Workspace wspc)
      Set the only workspace that publication must belong.

      Default behavior of query handler is to search in all workspaces.

      This method is exclusive with setWrkspc(String...), setWs(String), and setWorkspaceSet(Set).

      Overrides:
      setWorkspace in class JcmsFormHandler
      Parameters:
      wspc - a Workspace or null to search in all workspaces
      Since:
      jcms-7.1.3, jcms-8.0.0
      See Also:
    • setWorkspaceSet

      public void setWorkspaceSet(Set<Workspace> wsSet)
      Set the Workspaces that publication must belong.

      Default behavior of query handler is to search in all workspaces.

      This method is exclusive with setWrkspc(String...), setWs(String), and setWorkspace(Workspace).

      Parameters:
      wsSet - a Set of Workspace to refine on.
      Since:
      jcms-7.1.3, jcms-8.0.0, JCMS-3331
      See Also:
    • getAllCidSet

      public Set<String> getAllCidSet()
      Returns all the cids contained in this query and all historized queries.
      Returns:
      a set of cids
    • getUserLang

      public String getUserLang()
      Description copied from class: JcmsContext
      Retrieves the user lang variable for this context.
      Fast: this method is cached using initDone (it is recomputed only on forceUpdate() or setRequest()).
      Overrides:
      getUserLang in class JcmsContext
      Returns:
      the user lang (define in InitFilter, guessed either from logged member lang, userLang portlet action, http request Accept-Language header, or defaut channel language
    • getDescription

      public String getDescription()
      Returns a description of the query in the language defined by userLang of this handler.
      Returns:
      the string of the description
    • getDescription

      public String getDescription(String lang)
      Returns a description of the query in the specified language.
      Parameters:
      lang - the ISO-639 code of the language in which to retrieve the query description
      Returns:
      the string of the description
    • getBeginAndEndDates

      public Date[] getBeginAndEndDates()
      Compute begin and end date of a query from QueryHandler values.
      Returns:
      an array of two Date, the first is the begin date, the second the end Date.
    • getHighlightedMember

      public Member getHighlightedMember()
    • getClassSet

      public HashSet<Class<? extends Publication>> getClassSet()
      Return a set of classes corresponding to the 'types' attributes
      Returns:
      a set of class
    • getClassOffSet

      public HashSet<Class<? extends Publication>> getClassOffSet()
      Return a set of classes corresponding to the 'typesOff' attributes
      Returns:
      a set of class
    • getMostRecentTextInHistoryVisitor

      protected static void getMostRecentTextInHistoryVisitor(String[] textAndMode, QueryHandler qh)
      Internal recursive method used to look for most recent text.
      Parameters:
      textAndMode - MUST be an allocated array of String[2] that will be filled with the text and mode if available.
      qh - the QueryHandler
    • getMostRecentTextAndModeInHistory

      protected String[] getMostRecentTextAndModeInHistory()
      Returns:
      the most recent text in the search history and the mode used, as an array of 2 String, with text as first and mode as second. this method is NOT CACHED and quite SLOW, cache the result yourself. (Used by highlight).
    • addHighlightAttributes

      public void addHighlightAttributes(javax.servlet.http.HttpServletRequest request)
      Add highlight attributes to the given request.
      Parameters:
      request - the current request
    • clearHighlightAttributes

      public void clearHighlightAttributes(javax.servlet.http.HttpServletRequest request)
      Remove highlight attributes of the given request.
      Parameters:
      request - the current request
    • setMode

      public void setMode(String m)
      Define the text mode to use to perform the text search.
      Parameters:
      m - a string representing the mode to use, from one of those values : The specified string will be kept only if choosen from thoses values.
    • getMode

      public String getMode()
      Retrieve the string representation of the current text mode being to perform the text search.
      Returns:
      a string from one of the valid values in
      See Also:
    • isModeAll

      public boolean isModeAll()
      Checks if the current text mode is to find all words of the search string.
      Returns:
      true if getMode() equals TEXT_MODE_ALL_WORDS, false otherwise.
      Since:
      jcms-5.6.2
    • isModeAny

      public boolean isModeAny()
      Checks if the current text mode is to find at least one word of the search string.
      Returns:
      true if getMode() equals TEXT_MODE_ANY_WORD, false otherwise.
      Since:
      jcms-5.6.2
    • isModeExact

      public boolean isModeExact()
      Checks if the current text mode is to find the exact phrase specified in the search string.
      Returns:
      true if getMode() equals TEXT_MODE_EXACT, false otherwise.
      Since:
      jcms-5.6.2
    • isModeAdvanced

      public boolean isModeAdvanced()
      Checks if the current text mode is to perform the search using advanced search syntaxt.
      Returns:
      true if getMode() equals TEXT_MODE_ADVANCED, false otherwise.
      Since:
      jcms-5.6.2
    • setText

      public void setText(String text)
      Sets the text to search in this query. Default value is null.

      The specified text will be search in publications/categories/archives/files depending on other parameters of this query, see setSearchInPub(boolean), setCatName(boolean).

      The specified text will be search in various way depending on the search mode, see setMode(String) for more information.

      Parameters:
      text - a String to be searched
    • getText

      public String getText()
      Retrieve the current text being searched in this query.
      Returns:
      a String, may be null if no text search is being performed.
    • setTextSearch

      public void setTextSearch(boolean textSearch)
      Indicate whether the search being performed through this query is a mainly a text search prior to other things. Default value is false.

      The changing behavior occurs when setting the text to null or an empty string : if set to true, the query will returns an empty result set, if set to false the query will be performed with other parameters.

      Parameters:
      textSearch - true to indicate that this query is a text search, false otherwise.
    • getTextSearch

      public boolean getTextSearch()
      Checks if this query is mainly a text search.
      Returns:
      true if this query is mainly a text search, false if this query is not specifically decicated to text search.
      See Also:
    • getCatName

      public boolean getCatName()
    • setCatName

      public void setCatName(boolean v)
    • getExactCat

      public boolean getExactCat()
    • setExactCat

      public void setExactCat(boolean v)
    • getSearchInPub

      public boolean getSearchInPub()
    • setSearchInPub

      public void setSearchInPub(boolean v)
    • getSearchInFiles

      public boolean getSearchInFiles()
    • setSearchInFiles

      public void setSearchInFiles(boolean v)
    • getSearchInDB

      public boolean getSearchInDB()
    • setSearchInDB

      public void setSearchInDB(boolean v)
    • getSearchInMembers

      public boolean getSearchInMembers()
    • setSearchInMembers

      public void setSearchInMembers(boolean v)
    • getSearchInSubWorkspaces

      public boolean getSearchInSubWorkspaces()
      Gets whether search is performed on the exact specified workspace(s) or by also including their children.
      Returns:
      true to search in children workspace(s) of the workspace(s) specified, false to search only in the exact workspace(s) specified.
      Since:
      jcms-7.1.3, jcms-8.0.0, JCMS-3331
      See Also:
    • setSearchInSubWorkspaces

      public void setSearchInSubWorkspaces(boolean searchInSubWorkspaces)
      Set whether to perform search on the exact specified workspace(s) or on their children too.

      Default behavior is to search only in the exact workspaces specified (if any).

      Parameters:
      searchInSubWorkspaces - set to true to search in children workspace(s) of the workspace(s) specified, false to search only in the exact workspace(s) specified.
      Since:
      jcms-7.1.3, jcms-8.0.0, JCMS-3331
      See Also:
    • getCids

      public String[] getCids()
    • setCids

      public void setCids(String... v)
    • getCidsOff

      public String[] getCidsOff()
    • setCidsOff

      public void setCidsOff(String... v)
    • getMids

      public String[] getMids()
    • setMids

      public void setMids(String... v)
    • getMidsOff

      public String[] getMidsOff()
    • setMidsOff

      public void setMidsOff(String... v)
    • getMidsOpAuthor

      public String[] getMidsOpAuthor()
      Retrieve the opAuthor that publication must match in order to be found
      Returns:
      the current opAuthor refinement ids
      Since:
      jcms-10.0.5 / JCMS-8387
    • setMidsOpAuthor

      public void setMidsOpAuthor(String... ids)
      Set opAuthor that publication must match in order to be found.

      Value "loggedMember" may be set to query the Publication whose opAuthor is current logged Member.

      Parameters:
      ids - Member ids
      Since:
      jcms-10.0.5 / JCMS-8387
    • getGids

      public String[] getGids()
    • setGids

      public void setGids(String... v)
    • getGidsOff

      public String[] getGidsOff()
    • setGidsOff

      public void setGidsOff(String... v)
    • getPortalIds

      public String[] getPortalIds()
    • setPortalIds

      public void setPortalIds(String... v)
    • getBeginDate

      public Date getBeginDate()
      Retrieve the begin date used in range search.
      Returns:
      the begin date being used
    • setBeginDate

      public void setBeginDate(Date date)
      Set the begin date for range search.

      Setting this date will automatically update the begin day, begin month and begin year values accordingly so that begin date is kept in query string (behavior introduce in JCMS 9)

      Parameters:
      date - the end date to use in date range search
    • setBeginDateStr

      public void setBeginDateStr(String dateStr)
      Set the begin date using value received from a JCMS date chooser in the current user language.
      Parameters:
      dateStr - the date (as formatted by a date chooser)
      See Also:
    • setBeginDateW3c

      public void setBeginDateW3c(String dateW3c)
      Set the begin date to be used in this query.

      Setting this date will automatically update the begin day, end month and end year values accordingly so that begin date is kept in query string (behavior introduce in JCMS 9)

      Parameters:
      dateW3c - a date formatted using W3C format, see DateUtil.parseW3cDate(String) for more information on this format.
      Since:
      jcms-5.7.2
      See Also:
    • getEndDate

      public Date getEndDate()
      Retrieve the end date being used in range search
      Returns:
      the end date being used
    • setEndDate

      public void setEndDate(Date date)
      Set the end date for range search.

      Setting this date will automatically update the end day, end month and end year values accordingly so that end date is kept in query string (behavior introduce in JCMS 9)

      Parameters:
      date - the end date to use in date range search
    • setEndDateStr

      public void setEndDateStr(String dateStr)
      Set the end date using value received from a JCMS date chooser in the current user language.

      Setting this date will automatically update the end day, end month and end year values accordingly so that end date is kept in query string (behavior introduce in JCMS 9)

      Parameters:
      dateStr - the date (as formatted by a date chooser)
      Since:
      jcms-9.0
      See Also:
    • setEndDateW3c

      public void setEndDateW3c(String dateW3c)
      Set the end date to be used in this query.

      Setting this date will automatically update the end day, end month and end year values accordingly so that end date is kept in query string (behavior introduce in JCMS 9)

      Parameters:
      dateW3c - a date formatted using W3C format, see DateUtil.parseW3cDate(String) for more information on this format.
      Since:
      jcms-5.7.2
      See Also:
    • getBeginDay

      public int getBeginDay()
    • setBeginDay

      public void setBeginDay(int v)
    • getBeginMonth

      public int getBeginMonth()
    • setBeginMonth

      public void setBeginMonth(int v)
    • getBeginYear

      public int getBeginYear()
    • setBeginYear

      public void setBeginYear(int v)
    • getEndDay

      public int getEndDay()
    • setEndDay

      public void setEndDay(int v)
    • getEndMonth

      public int getEndMonth()
    • setEndMonth

      public void setEndMonth(int v)
    • getEndYear

      public int getEndYear()
    • setEndYear

      public void setEndYear(int v)
    • getDateType

      public String getDateType()
      Retrieve the date type being used for date range search.
      Returns:
      a value matching common date identifier. eg cdate (default type if empty or invalid), pdate, mdate, edate, ...
    • setDateType

      public void setDateType(String type)
      Set the date type being used for date range search.
      Parameters:
      type - a value matching common date identifier. eg cdate (default type if empty or invalid), pdate, mdate, edate, ...
    • setCatMode

      public void setCatMode(String v)
      Define the mode to use when dealing with categories.

      You can specify any of the following value:

      • "or": Union of categories
      • "and": Intersection of categories (default mode if empty or invalid)
      Parameters:
      v - "or" or "and"
    • getCatMode

      public String getCatMode()
      Retrieve the mode to use when dealing with categories.

      Returns:
      "or" for Union of categories, "and" for Intersection of categories (default mode if empty or invalid).
    • getDateSinceInt

      public int getDateSinceInt()
    • setDateSince

      public void setDateSince(String v)
    • setDateSince

      public void setDateSince(int v)
    • getHist

      public String getHist()
    • setHist

      public void setHist(String v)
    • getHistLevel

      public int getHistLevel()
    • setHistLevel

      public void setHistLevel(int v)
    • getSort

      public String getSort()
    • setSort

      public void setSort(String sort)
    • getReverse

      public boolean getReverse()
    • setReverse

      public void setReverse(boolean v)
    • getTypes

      public String[] getTypes()
    • setTypes

      public void setTypes(String... types)
    • validateTypesArray

      protected static String[] validateTypesArray(String[] types)
      Validate the specified types array
      Parameters:
      types -
      Returns:
      a new array
    • getTypesOff

      public String[] getTypesOff()
    • setTypesOff

      public void setTypesOff(String... typesOff)
    • getExactType

      public boolean getExactType()
    • setExactType

      public void setExactType(boolean v)
    • getWfId

      public String getWfId()
    • setWfId

      public void setWfId(String wfId)
    • getPstatus

      public String[] getPstatus()
      Retrieves the pstatus values to be searched by this query.

      This method returns the original value defined with the setter setPstatus(String...), use getIntPstatus() to retrieve the resolved pstatus values as an int array.

      Returns:
      an array of String, each string representing a pstatus value (int) to be searched for
      Since:
      jcms-2.1
      See Also:
    • setPstatus

      public void setPstatus(String... pstatus)
      Sets the pstatus values to be searched by this query.
      Parameters:
      pstatus - an array of String, each string representing a pstatus value (int) to be searched for empty values in the array are ignored, if given array is null, pstatus search is reset.
      Since:
      jcms-2.1
    • getIntPstatus

      public int[] getIntPstatus()
      Retrieves the current pstatus values to be searched by this query.
      Returns:
      an array of int, each int is a pstatus value to be searched for
      Since:
      jcms-2.1
    • getCheckPstatus

      public boolean getCheckPstatus()
    • setCheckPstatus

      public void setCheckPstatus(boolean v)
    • setLangs

      public void setLangs(String... langArray)
      The language(s) in which publications must have been translated to be part of the results.

      A publication is considered translated in a language according to rules defines by Publication.checkLang(String), ie if the title or the abstract have been specified in the language.

      Default behavior is to search for all content, without restriction on the translated language.

      Not to be confused with setContentLangs(String...)

      Parameters:
      langArray - an array containing ISO-639 language code and/or "user" value which is replaced with the current user lang as retieved by getUserLang().
    • getLangs

      public String[] getLangs()
      Retrieve the language in which publications must have been translated to be part of the results.

      If the "user" value was specified in setLangs(String...) this method will return the user language resolved at the time of the setter invocation.

      Returns:
      an array containing ISO-639 language code, null if default behavior was applied
    • getUnresolvedLangs

      public String[] getUnresolvedLangs()
      Retrieve the language in which publications must have been translated to be part of the results.

      This method is said to return an "unresolved" language value because if the "user" value was specified in setLangs(String...) it will be returned as is (contrary to method getLangs() which return the user language resolved at the time of the setter invocation)

      Returns:
      an array containing ISO-639 language code and/or "user" value, null if default behavior was applied
    • setContentLangs

      public void setContentLangs(String... langArray)
      The language(s) in which text search will be performed, that is, the language(s) of the publications' fields values in which to search for the specified text.

      Default behavior is to search for the specified text in all language variation of the publications' fields.

      If "user" is specified as a paramter value, it is replaced with the current user lang as retieved by getUserLang() ugetUserLang()).

      Not to be confused with setLangs(String...)

      Parameters:
      langArray - an array containing ISO-639 language code and/or "user" value which is replaced with the current user lang as retieved by getUserLang().
      Since:
      jcms-8.0.0
    • getContentLangs

      public String[] getContentLangs()
      Retrieve the language in which text search is performed.

      If the "user" value was specified in setContentLangs(String...) this method will return the user language resolved at the time of the setter invocation.

      Not to be confused with getLangs()

      Returns:
      an array containing ISO-639 language code, null if default behavior was applied
      Since:
      jcms-8.0.0
    • getUnresolvedContentLangs

      public String[] getUnresolvedContentLangs()
      Retrieve the language in which text search is performed.

      This method is said to return an "unresolved" language value because if the "user" value was specified in setContentLangs(String...) it will be returned as is (contrary to method getContentLangs() which return the user language resolved at the time of the setter invocation)

      Not to be confused with getUnresolvedLangs()

      Returns:
      an array containing ISO-639 language code and/or "user" value, null if default behavior was applied
      Since:
      jcms-8.0.0
    • getSearchedFields

      public String[] getSearchedFields()
      Retrieves the lucene fields in which the text search is being performed for publications.
      Returns:
      an array of lucene field name in which to do the text search. (if null or empty default behavior is used)
    • setSearchedFields

      public void setSearchedFields(String... searchedFields)
      Defines the (lucene) publications fields in which to perform the text search.
      Parameters:
      searchedFields - an array of lucene field name in which to do the text search. if null or empty will use default behavior.
    • setAbility

      public void setAbility(String ability)
      Sets the portal element's ability to match when PortalElement are found.
      Parameters:
      ability - an ability choosen from values returned by PortalElement.getAllAbilities(), or "noabilities" for portlet without any ability, or "hasabilities" for portlet with any ability.
    • getAbility

      public String getAbility()
      Retrieves the current the portal element's ability defined for this QueryHandler.
      Returns:
      the ability defined for this query.
    • getStart

      public int getStart()
    • setStart

      public void setStart(int start)
    • getPageSize

      public int getPageSize()
    • setPageSize

      public void setPageSize(int pageSize)
    • getPagerAll

      public boolean getPagerAll()
    • setPagerAll

      public void setPagerAll(boolean pagerAll)
    • getHistoryList

      public List<String> getHistoryList()
      Not set : - before the query method has been called. - for internal queryHandlers used for refinement in QueryManager.query processing.
      Returns:
      the list of the descriptions of the current query and the query recursively in "hist" request param.
    • setHistoryList

      public void setHistoryList(List<String> historyList)
      Set the list of descriptions of the query and the query recursively in "hist" request param.
      Parameters:
      historyList - the history list
    • setDocumentKinds

      public void setDocumentKinds(String... kinds)
      Set the kind of document to match for this QueryHandler
      Parameters:
      kinds - an array of document kind (e.g "pdf", "image", "spreadsheet", ...)
      Since:
      jcms-6.1
    • getDocumentKinds

      public String[] getDocumentKinds()
      Retrieve the kind of document defined for this QueryHandler
      Returns:
      a set of content type, never return null
      Since:
      jcms-6.1
    • getAdvanced

      public String getAdvanced()
    • setAdvanced

      public void setAdvanced(String advanced)
    • appendAdvanced

      public void appendAdvanced(String key, Object value)
    • appendAdvanced

      public void appendAdvanced(String key, Object[] values)
    • getDocumentKindsGroupMap

      public static Map<String,String> getDocumentKindsGroupMap(String userLang)
      Retrieve a map of all document kind group defined in properties.
      Parameters:
      userLang - the ISO-639 language code in which to retrieve labels
      Returns:
      a Map of group kind name (e.g. "office", "media", "misc") to document kind group label (e.g "Office documents", "Medias", "Other", ...)
      Since:
      jcms-6.1
    • getDocumentKindsMap

      public static Map<String,String> getDocumentKindsMap(String userLang, String kindGroup)
      Retrieve a map of all document kind for the specified kind group.
      Parameters:
      userLang - the ISO-639 language code in which to retrieve labels
      kindGroup - document kind group as retrieve in key of map returned by getDocumentKindsGroupMap(String)
      Returns:
      a Map of kind name (e.g. "spreasheet", "wordprocessing", ...) to document kind label (e.g "Spreadsheet", "Word processing", ...)
      Since:
      jcms-6.1
    • getContentTypesFromDocumentKind

      public static List<String> getContentTypesFromDocumentKind(String kind)
      Retrieve the content type to use for the specified document kind
      Parameters:
      kind - a document kind, as retrieved by getDocumentKindsMap(String, String)
      Returns:
      an list of content types
      Since:
      jcms-6.1
    • isHybridSearch

      public boolean isHybridSearch()
      Returns true if this is an hybrid search (i.e. JStore and JcmsDB).
      Returns:
      true if this is an hybrid search (i.e. JStore and JcmsDB).
      Since:
      jcms-6.2.0
    • getTypesCommonSuperClass

      public static Class<? extends Publication> getTypesCommonSuperClass(QueryHandler... queryHandlers)
      Retrieve the common super class of types specified in the QueryHandler.

      Eg :

       assertEquals(Publication.class, QueryHandler.getTypesCommonSuperClass((QueryHandler[]) null));
       assertEquals(Article.class, QueryHandler.getTypesCommonSuperClass(new QueryHandler("types=Article")));
        assertEquals(Content.class, QueryHandler.getTypesCommonSuperClass(new QueryHandler("types=Article&types=SmallNews"))); 
       assertEquals(AbstractPortletSkinable.class, QueryHandler.getTypesCommonSuperClass(new
        QueryHandler("types=PortletJsp&types=PortletQueryForeachDetail")));
        assertEquals(Publication.class, QueryHandler.getTypesCommonSuperClass(new QueryHandler("types=Article&types=PortletJsp"))); 
       
      Parameters:
      queryHandlers - one or several QueryHandler which will be used to extract the common super class of the specified types parameter
      Returns:
      a Class, never return null (default to Publication.class in case class could not be found )
      Since:
      jcms-7.1.0
    • getQueryFilterContext

      public Map<String,Object> getQueryFilterContext()
    • getSearchInTrash

      public boolean getSearchInTrash()
      Get option indicating if content in trash are included in result or not.

      Default is to exclude trashed publication from result.

      Returns:
      true if trashed publication will be included in result, false if they are excluded (default)
      Since:
      jcms-10.0.5 / JCMS-8353
    • setSearchInTrash

      public void setSearchInTrash(boolean searchInTrash)
      Set option indicating if content in trash are included in result or not.

      Default is to exclude trashed publication from result.

      Parameters:
      searchInTrash - true if trashed publication are to be included in result, false if they are to be excluded (default)
      Since:
      jcms-10.0.5 / JCMS-8353
    • getClassificationLevel

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

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

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

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

      public ControllerStatus checkQuery()
      Check if the query represented by this QueryHandler is valid.

      When a query is not valid, it will not return any results.

      Implementation details:
      A query is considered invalid when all ids specified for one of the following filter parameters were invalid :

      Examples :
      • "wrkpsc=<a-valid-id>": query is valid
      • "wrkpsc=<a-valid-id>&wrkpsc=<a-valid-id>": query is valid
      • "wrkpsc=<a-valid-id>&wrkpsc=<an-invalid-id>": query is invalid
      • "wrkpsc=<an-invalid-id>&wrkpsc=<an-invalid-id>": query is invalid
      • "cids=<a-valid-id>&wrkpsc=<an-invalid-id>": query is invalid
      Returns:
      a ControllerStatus indicating the validation failure if any, or ControllerStatus.OK if query is valid. (never return null)
      Since:
      10.0.9 / JCMS-11150