Class GetQueryFromJSONHelper

java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.cms.search.GetQueryFromJSONHelper
All Implemented Interfaces:
Component, LogEnabled, Serviceable

Helper to get query infos from JSON object
  • Field Details

    • ROLE

      public static final String ROLE
      The Avalon role name
  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager serviceManager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • getSearchModel

      public SearchModel getSearchModel(Map<String,Object> parameters)
      Retrieves the search UI model
      Parameters:
      parameters - The JS parameters
      Returns:
      the search UI model
    • getSearchModel

      public SearchModel getSearchModel(Map<String,Object> parameters, String modelKeyName)
      Retrieves the search UI model
      Parameters:
      parameters - The JS parameters
      modelKeyName - key name of the model parameter
      Returns:
      the search UI model
    • getQueryFromModel

      public Query getQueryFromModel(SearchModel model, Map<String,Object> parameters, List<String> contentTypes) throws QuerySyntaxException
      Retrieves a Query object from the SearchUIModel and the JSON parameters
      Parameters:
      model - Model
      parameters - JSON parameters
      contentTypes - List of content types to fill
      Returns:
      the created Query object
      Throws:
      QuerySyntaxException - If an error occurs during the query parsing
    • getColumnsFromSearchModel

      public List<String> getColumnsFromSearchModel(SearchModel model, Map<String,Object> contextualParameters)
      Retrieves a list of column ids
      Parameters:
      model - search model containing result fields
      contextualParameters - JSON object containing the contextual parameters
      Returns:
      a list of columns ids
    • getSort

      public List<Sort> getSort(Map<String,Object> parameters)
      Retrieves the sort criteria from a sort string.
      Parameters:
      parameters - The parameters (containing sort and optionally group keys)
      Returns:
      the sort criteria as a List of Sort.
    • getSort

      public List<Sort> getSort(String sortString, String groupString)
      Retrieves the sort criteria from a sort string.
      Parameters:
      sortString - The sort criteria as a JSON-encoded string.
      groupString - The group criteria as a JSON-encoded string (for server-side grouping feature). Can be null.
      Returns:
      the sort criteria as a List of Sort.