Class QueryHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.queriesdirectory.QueryHelper
-
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
public class QueryHelper extends AbstractLogEnabled implements Serviceable, Component
Helper for manipulatingQuery
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentSearcherFactory
_contentSearcherFactory
Content Searcher Factoryprotected JSONUtils
_jsonUtils
JSON Utilsprotected ServiceManager
_manager
The service managerprotected AmetysObjectResolver
_resolver
The Ametys object resolverprotected SearchUIModelExtensionPoint
_searchUiEP
SearchUI Model Extension Pointstatic String
ROLE
Avalon Role
-
Constructor Summary
Constructors Constructor Description QueryHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AmetysObjectIterable<Content>
executeQuery(String queryId)
Execute a queryAmetysObjectIterable<Content>
executeQuery(Query query)
Execute a queryList<String>
getContentTypesForQuery(Map<String,Object> exportParams)
Get the Content Types of the query based on exportParamsMap<String,Object>
getContextualParametersForQuery(Map<String,Object> exportParams)
Get the contextual parameters of the query based on exportParamsMap<String,Object>
getExportParams(Query query)
Get the export params of the queryint
getLimitForQuery(Map<String,Object> exportParams)
Get the limit of results stored in a query, or -1 if none is foundString
getModelForQuery(Map<String,Object> exportParams)
Get the model of the query based on exportParamsString
getQueryStringForQuery(Map<String,Object> exportParams)
Get the solr query string of the query based on exportParamsString
getSearchModeForQuery(Map<String,Object> exportParams)
Get the search model of the query based on exportParamsList<Sort>
getSortForQuery(Map<String,Object> exportParams)
Get the sort of the query based on exportParamsMap<String,Object>
getValuesForQuery(Map<String,Object> exportParams)
Get the values of the query based on exportParamsvoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
_jsonUtils
protected JSONUtils _jsonUtils
JSON Utils
-
_searchUiEP
protected SearchUIModelExtensionPoint _searchUiEP
SearchUI Model Extension Point
-
_contentSearcherFactory
protected ContentSearcherFactory _contentSearcherFactory
Content Searcher Factory
-
_manager
protected ServiceManager _manager
The service manager
-
-
Constructor Detail
-
QueryHelper
public QueryHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
executeQuery
public AmetysObjectIterable<Content> executeQuery(String queryId) throws Exception
Execute a query- Parameters:
queryId
- id of the query to execute- Returns:
- the results of the query
- Throws:
Exception
- something went wrong
-
executeQuery
public AmetysObjectIterable<Content> executeQuery(Query query) throws Exception
Execute a query- Parameters:
query
- the query to execute- Returns:
- the results of the query, can be null
- Throws:
Exception
- something went wrong
-
getLimitForQuery
public int getLimitForQuery(Map<String,Object> exportParams)
Get the limit of results stored in a query, or -1 if none is found- Parameters:
exportParams
- export params of the query, available viagetExportParams(Query)
- Returns:
- the maximum number of results that this query should return, -1 if no limit
-
getModelForQuery
public String getModelForQuery(Map<String,Object> exportParams)
Get the model of the query based on exportParams- Parameters:
exportParams
- export params of the query, available viagetExportParams(Query)
- Returns:
- the model of the query
-
getValuesForQuery
public Map<String,Object> getValuesForQuery(Map<String,Object> exportParams)
Get the values of the query based on exportParams- Parameters:
exportParams
- export params of the query, available viagetExportParams(Query)
- Returns:
- the values of the query
-
getContextualParametersForQuery
public Map<String,Object> getContextualParametersForQuery(Map<String,Object> exportParams)
Get the contextual parameters of the query based on exportParams- Parameters:
exportParams
- export params of the query, available viagetExportParams(Query)
- Returns:
- the contextual parameters of the query
-
getSortForQuery
public List<Sort> getSortForQuery(Map<String,Object> exportParams)
Get the sort of the query based on exportParams- Parameters:
exportParams
- export params of the query, available viagetExportParams(Query)
- Returns:
- the sort of the query
-
getContentTypesForQuery
public List<String> getContentTypesForQuery(Map<String,Object> exportParams)
Get the Content Types of the query based on exportParams- Parameters:
exportParams
- export params of the query, available viagetExportParams(Query)
- Returns:
- the Content Types of the query
-
getQueryStringForQuery
public String getQueryStringForQuery(Map<String,Object> exportParams)
Get the solr query string of the query based on exportParams- Parameters:
exportParams
- export params of the query, available viagetExportParams(Query)
- Returns:
- the solr query string of the query
-
getSearchModeForQuery
public String getSearchModeForQuery(Map<String,Object> exportParams)
Get the search model of the query based on exportParams- Parameters:
exportParams
- export params of the query, available viagetExportParams(Query)
- Returns:
- the search model of the query
-
getExportParams
public Map<String,Object> getExportParams(Query query)
Get the export params of the query- Parameters:
query
- the query- Returns:
- the export params of the query
-
-