Class QueryHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.queriesdirectory.QueryHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
Helper for manipulating
Query
-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentSearcherFactory
Content Searcher Factoryprotected JSONUtils
JSON Utilsprotected ServiceManager
The service managerprotected AmetysObjectResolver
The Ametys object resolverprotected SearchUIModelExtensionPoint
SearchUI Model Extension Pointstatic final String
Avalon Role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionexecuteQuery
(String queryId) Execute a queryexecuteQuery
(Query query) Execute a querygetContentTypesForQuery
(Map<String, Object> exportParams) Get the Content Types of the query based on exportParamsgetContextualParametersForQuery
(Map<String, Object> exportParams) Get the contextual parameters of the query based on exportParamsgetExportParams
(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 foundgetModelForQuery
(Map<String, Object> exportParams) Get the model of the query based on exportParamsgetQueryStringForQuery
(Map<String, Object> exportParams) Get the solr query string of the query based on exportParamsgetSearchModeForQuery
(Map<String, Object> exportParams) Get the search model of the query based on exportParamsgetSortForQuery
(Map<String, Object> exportParams) Get the sort of the query based on exportParamsgetValuesForQuery
(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 Details
-
ROLE
Avalon Role -
_resolver
The Ametys object resolver -
_jsonUtils
JSON Utils -
_searchUiEP
SearchUI Model Extension Point -
_contentSearcherFactory
Content Searcher Factory -
_manager
The service manager
-
-
Constructor Details
-
QueryHelper
public QueryHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
executeQuery
Execute a query- Parameters:
queryId
- id of the query to execute- Returns:
- the results of the query
- Throws:
Exception
- something went wrong
-
executeQuery
Execute a query- Parameters:
query
- the query to execute- Returns:
- the results of the query, can be null
- Throws:
Exception
- if failed to execute query
-
getLimitForQuery
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
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
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
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
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
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
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
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
Get the export params of the query- Parameters:
query
- the query- Returns:
- the export params of the query
-