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
,Contextualizable
,LogEnabled
,Serviceable
public class GetQueryFromJSONHelper extends AbstractLogEnabled implements Component, Serviceable, Contextualizable
Helper to get query infos from JSON object
-
-
Constructor Summary
Constructors Constructor Description GetQueryFromJSONHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
contextualize(Context context)
List<String>
getColumnsFromSearchModel(SearchUIModel model, Map<String,Object> contextualParameters)
Retrieves a list of column idsQuery
getQueryFromModel(SearchUIModel model, Map<String,Object> parameters, List<String> contentTypes)
Retrieves a Query object from the SearchUIModel and the JSON parametersSearchUIModel
getSearchUIModel(Map<String,Object> parameters)
Retrieves the search UI modelSearchUIModel
getSearchUIModel(Map<String,Object> parameters, String modelKeyName)
Retrieves the search UI modelList<Sort>
getSort(String sortString, String groupString)
Retrieves the sort criteria from a sort string.List<Sort>
getSort(Map<String,Object> parameters)
Retrieves the sort criteria from a sort string.void
service(ServiceManager serviceManager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Constructor Detail
-
GetQueryFromJSONHelper
public GetQueryFromJSONHelper()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
getSearchUIModel
public SearchUIModel getSearchUIModel(Map<String,Object> parameters)
Retrieves the search UI model- Parameters:
parameters
- The JS parameters- Returns:
- the search UI model
-
getSearchUIModel
public SearchUIModel getSearchUIModel(Map<String,Object> parameters, String modelKeyName)
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(SearchUIModel model, Map<String,Object> parameters, List<String> contentTypes) throws QuerySyntaxException
Retrieves 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(SearchUIModel 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
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
.
-
-