Package org.ametys.cms.search
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetColumnsFromSearchModel(SearchModel model, Map<String, Object> contextualParameters) Retrieves a list of column idsgetQueryFromModel(SearchModel model, Map<String, Object> parameters, List<String> contentTypes) Retrieves a Query object from the SearchUIModel and the JSON parametersgetSearchModel(Map<String, Object> parameters) Retrieves the search UI modelgetSearchModel(Map<String, Object> parameters, String modelKeyName) Retrieves the search UI modelRetrieves the sort criteria from a sort string.Retrieves the sort criteria from a sort string.voidservice(ServiceManager serviceManager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
The Avalon role name
-
-
Constructor Details
-
GetQueryFromJSONHelper
public GetQueryFromJSONHelper()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getSearchModel
Retrieves the search UI model- Parameters:
parameters- The JS parameters- Returns:
- the search UI model
-
getSearchModel
Retrieves the search UI model- Parameters:
parameters- The JS parametersmodelKeyName- 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 QuerySyntaxExceptionRetrieves a Query object from the SearchUIModel and the JSON parameters- Parameters:
model- Modelparameters- JSON parameterscontentTypes- 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 fieldscontextualParameters- JSON object containing the contextual parameters- Returns:
- a list of columns ids
-
getSort
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
ContentSearcherFactory.ContentSearchSort.
-
getSort
public List<ContentSearcherFactory.ContentSearchSort> 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
ContentSearcherFactory.ContentSearchSort.
-