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
-
-
Field Summary
Fields Modifier and Type Field Description private ContentTypeExtensionPoint_contentTypeExtensionPointprivate Context_contextprivate JSONUtils_jsonUtilsprivate QueryBuilder_queryBuilderprivate SearchUIModelExtensionPoint_searchUIModelExtensionPointprivate ServiceManager_serviceManagerstatic StringROLEThe Avalon role name
-
Constructor Summary
Constructors Constructor Description GetQueryFromJSONHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontextualize(Context context)List<String>getColumnsFromSearchModel(SearchUIModel model, Map<String,Object> contextualParameters)Retrieves a list of column idsQuerygetQueryFromModel(SearchUIModel model, Map<String,Object> parameters, List<String> contentTypes)Retrieves a Query object from the SearchUIModel and the JSON parametersSearchUIModelgetSearchUIModel(Map<String,Object> parameters)Retrieves the search UI modelSearchUIModelgetSearchUIModel(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.voidservice(ServiceManager serviceManager)-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_searchUIModelExtensionPoint
private SearchUIModelExtensionPoint _searchUIModelExtensionPoint
-
_contentTypeExtensionPoint
private ContentTypeExtensionPoint _contentTypeExtensionPoint
-
_queryBuilder
private QueryBuilder _queryBuilder
-
_jsonUtils
private JSONUtils _jsonUtils
-
_serviceManager
private ServiceManager _serviceManager
-
-
Constructor Detail
-
GetQueryFromJSONHelper
public GetQueryFromJSONHelper()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein 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.
-
-