Class SearchService
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.service.StaticService
-
- org.ametys.web.frontoffice.search.SearchService
-
- All Implemented Interfaces:
Model
,ModelItemAccessor
,ModelItemContainer
,LogEnabled
,PluginAware
,Labelable
,Service
,Disposable
,Configurable
,Contextualizable
,Serviceable
public class SearchService extends StaticService
Front search service.
-
-
Field Summary
Fields Modifier and Type Field Description protected SearchServiceCreationHelper
_creationHelper
The helper component for defining this serviceprotected RenderingContextHandler
_renderingContextHandler
The handler of rendering contextprotected SearchServiceInstanceManager
_searchServiceInstanceManager
The manager forSearchServiceInstance
static String
PARAM_NAME_COMPUTE_COUNTS
The parameter name for computing countsstatic String
PARAM_NAME_CONTEXTS
The parameter name for contextsstatic String
PARAM_NAME_CRITERIA
The parameter name for criteriastatic String
PARAM_NAME_FACETS
The parameter name for facetsstatic String
PARAM_NAME_HEADER
The parameter name for headerstatic String
PARAM_NAME_INITIAL_SORTS
The parameter name for initial sortsstatic String
PARAM_NAME_LAUNCH_SEARCH_AT_STARTUP
The parameter name for launching search at startupstatic String
PARAM_NAME_LINK_PAGE
The parameter name for link pagestatic String
PARAM_NAME_LINK_TITLE
The parameter name for link titlestatic String
PARAM_NAME_MAX_RESULTS
The parameter name for maximum number of resultsstatic String
PARAM_NAME_PROPOSED_SORTS
The parameter name for proposed sortsstatic String
PARAM_NAME_RESULT_PAGE
The parameter name for result pagestatic String
PARAM_NAME_RESULT_PLACE
The parameter name for result placestatic String
PARAM_NAME_RESULTS_PER_PAGE
The parameter name for number of results per pagestatic String
PARAM_NAME_RETURNABLES
The parameter name for returnablesstatic String
PARAM_NAME_RIGHT_CHECKING_MODE
The parameter name for right checking modestatic String
PARAM_NAME_RSS
The parameter name for handling RSSstatic String
PARAM_NAME_SAVE_USER_PREFS
The parameter name for saving user preferencesstatic String
PARAM_NAME_SERVICE_GROUP_ID
The parameter name for service group idstatic String
PARAM_NAME_XSLT
The parameter name for XSLTstatic String
ROLE
Avalon Role-
Fields inherited from class org.ametys.web.service.StaticService
_context, _featureName, _manager, _modelItems, _paramsScript, _pluginName, _repeaterDefinitionParser, _serviceParameterDefinitionParser, _view, _viewAndParametersParser
-
-
Constructor Summary
Constructors Constructor Description SearchService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Collection<AdditionalSearchServiceParameter>
_buildAdditionalSearchServiceParameters(Map<String,org.ametys.web.frontoffice.search.SearchService.ParsedAdditionalParameterConf> parsedAdditionalParameterConfs)
Build theAdditionalSearchServiceParameter
s from intermediateSearchService.ParsedAdditionalParameterConf
objects.protected List<String>
_fieldsReloadingWidget(Collection<AdditionalSearchServiceParameter> additionalParameters)
Gets the names of the fields which will launch a reload of this widget when their value changeprotected Map<String,org.ametys.web.frontoffice.search.SearchService.ParsedAdditionalParameterConf>
_parseAndInjectDisplayAdditionalParameters(DefaultConfiguration containerConf)
Retrieve the configurations of additional parameters for 'Display' group, inject them into the group configuration and return their parsed representation.protected Map<String,org.ametys.web.frontoffice.search.SearchService.ParsedAdditionalParameterConf>
_parseAndInjectGeneralAdditionalParameters(DefaultConfiguration containerConf)
Retrieve the configurations of additional parameters for 'General' group, inject them into the group configuration and return their parsed representation.protected void
_setWidgetParameters(String parameterName, List<String> fieldsReloadingCriteriaWidget)
Set the widget parameters of the given parameter, by adding the list of the fields reloading the widgetprotected void
configureParameters(Configuration parametersConfiguration)
Configure the service parametersstatic boolean
hasUserCriteria(Optional<AbstractTreeNode<FOSearchCriterion>> criterionTree)
Returnstrue
if the given instance of search service has at least one user criterionstatic boolean
hasUserInput(Optional<AbstractTreeNode<FOSearchCriterion>> criterionTree, Collection<FacetDefinition> facets, Collection<SortDefinition> proposedSorts)
Returnstrue
if the given instance of search service has some user inputboolean
isCacheable(Page currentPage, ZoneItem zoneItem)
Returns true if the result of this service may be cached, depending on theZoneItem
containing an instance of this service.void
service(ServiceManager smanager)
-
Methods inherited from class org.ametys.web.service.StaticService
_configureClass, _configureImports, _configureScript, _parseI18nizableText, configure, configureDialogBoxDimension, configureIndexation, contextualize, dispose, getCategory, getCreationBoxHeight, getCreationBoxWidth, getCSSFiles, getDescription, getIconDecorator, getIconGlyph, getId, getLabel, getLargeIcon, getMediumIcon, getModelItems, getName, getParameters, getParametersScript, getPluginName, getRight, getSmallIcon, getURL, getView, index, isPrivate, setPluginInfo
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.runtime.model.ModelItemAccessor
getChild, getModelItem, hasModelItem
-
Methods inherited from interface org.ametys.web.service.Service
getFamilyId
-
-
-
-
Field Detail
-
ROLE
public static final String ROLE
Avalon Role- See Also:
- Constant Field Values
-
PARAM_NAME_HEADER
public static final String PARAM_NAME_HEADER
The parameter name for header- See Also:
- Constant Field Values
-
PARAM_NAME_RETURNABLES
public static final String PARAM_NAME_RETURNABLES
The parameter name for returnables- See Also:
- Constant Field Values
-
PARAM_NAME_CONTEXTS
public static final String PARAM_NAME_CONTEXTS
The parameter name for contexts- See Also:
- Constant Field Values
-
PARAM_NAME_CRITERIA
public static final String PARAM_NAME_CRITERIA
The parameter name for criteria- See Also:
- Constant Field Values
-
PARAM_NAME_COMPUTE_COUNTS
public static final String PARAM_NAME_COMPUTE_COUNTS
The parameter name for computing counts- See Also:
- Constant Field Values
-
PARAM_NAME_FACETS
public static final String PARAM_NAME_FACETS
The parameter name for facets- See Also:
- Constant Field Values
-
PARAM_NAME_INITIAL_SORTS
public static final String PARAM_NAME_INITIAL_SORTS
The parameter name for initial sorts- See Also:
- Constant Field Values
-
PARAM_NAME_PROPOSED_SORTS
public static final String PARAM_NAME_PROPOSED_SORTS
The parameter name for proposed sorts- See Also:
- Constant Field Values
-
PARAM_NAME_RESULTS_PER_PAGE
public static final String PARAM_NAME_RESULTS_PER_PAGE
The parameter name for number of results per page- See Also:
- Constant Field Values
-
PARAM_NAME_MAX_RESULTS
public static final String PARAM_NAME_MAX_RESULTS
The parameter name for maximum number of results- See Also:
- Constant Field Values
-
PARAM_NAME_RIGHT_CHECKING_MODE
public static final String PARAM_NAME_RIGHT_CHECKING_MODE
The parameter name for right checking mode- See Also:
- Constant Field Values
-
PARAM_NAME_XSLT
public static final String PARAM_NAME_XSLT
The parameter name for XSLT- See Also:
- Constant Field Values
-
PARAM_NAME_RESULT_PLACE
public static final String PARAM_NAME_RESULT_PLACE
The parameter name for result place- See Also:
- Constant Field Values
-
PARAM_NAME_RESULT_PAGE
public static final String PARAM_NAME_RESULT_PAGE
The parameter name for result page- See Also:
- Constant Field Values
-
PARAM_NAME_LAUNCH_SEARCH_AT_STARTUP
public static final String PARAM_NAME_LAUNCH_SEARCH_AT_STARTUP
The parameter name for launching search at startup- See Also:
- Constant Field Values
-
PARAM_NAME_SERVICE_GROUP_ID
public static final String PARAM_NAME_SERVICE_GROUP_ID
The parameter name for service group id- See Also:
- Constant Field Values
-
PARAM_NAME_LINK_PAGE
public static final String PARAM_NAME_LINK_PAGE
The parameter name for link page- See Also:
- Constant Field Values
-
PARAM_NAME_LINK_TITLE
public static final String PARAM_NAME_LINK_TITLE
The parameter name for link title- See Also:
- Constant Field Values
-
PARAM_NAME_RSS
public static final String PARAM_NAME_RSS
The parameter name for handling RSS- See Also:
- Constant Field Values
-
PARAM_NAME_SAVE_USER_PREFS
public static final String PARAM_NAME_SAVE_USER_PREFS
The parameter name for saving user preferences- See Also:
- Constant Field Values
-
_creationHelper
protected SearchServiceCreationHelper _creationHelper
The helper component for defining this service
-
_renderingContextHandler
protected RenderingContextHandler _renderingContextHandler
The handler of rendering context
-
_searchServiceInstanceManager
protected SearchServiceInstanceManager _searchServiceInstanceManager
The manager forSearchServiceInstance
-
-
Constructor Detail
-
SearchService
public SearchService()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classStaticService
- Throws:
ServiceException
-
hasUserInput
public static boolean hasUserInput(Optional<AbstractTreeNode<FOSearchCriterion>> criterionTree, Collection<FacetDefinition> facets, Collection<SortDefinition> proposedSorts)
Returnstrue
if the given instance of search service has some user input- Parameters:
criterionTree
- The tree of criteria of the search service instancefacets
- The facets of the search service instanceproposedSorts
- The proposed sorts of the search service instance- Returns:
true
if the given instance of search service has some user input
-
hasUserCriteria
public static boolean hasUserCriteria(Optional<AbstractTreeNode<FOSearchCriterion>> criterionTree)
Returnstrue
if the given instance of search service has at least one user criterion- Parameters:
criterionTree
- The tree of criteria of the search service instance- Returns:
true
if the given instance of search service has at least one user criterion
-
isCacheable
public boolean isCacheable(Page currentPage, ZoneItem zoneItem)
Description copied from interface:Service
Returns true if the result of this service may be cached, depending on theZoneItem
containing an instance of this service.- Specified by:
isCacheable
in interfaceService
- Overrides:
isCacheable
in classStaticService
- Parameters:
currentPage
- the currentPage
containing the service.zoneItem
- theZoneItem
containing an instance of this service.
N.B: The ZoneItem can belong to a page that is not the current page, when it is inherited.- Returns:
- true if the result of this service may be cached.
-
configureParameters
protected void configureParameters(Configuration parametersConfiguration) throws ConfigurationException
Description copied from class:StaticService
Configure the service parameters- Overrides:
configureParameters
in classStaticService
- Parameters:
parametersConfiguration
- the parameters configuration- Throws:
ConfigurationException
- if a configuration exception occurred
-
_parseAndInjectGeneralAdditionalParameters
protected Map<String,org.ametys.web.frontoffice.search.SearchService.ParsedAdditionalParameterConf> _parseAndInjectGeneralAdditionalParameters(DefaultConfiguration containerConf)
Retrieve the configurations of additional parameters for 'General' group, inject them into the group configuration and return their parsed representation.- Parameters:
containerConf
- The container configuration for injecting.- Returns:
- the
SearchService.ParsedAdditionalParameterConf
s
-
_parseAndInjectDisplayAdditionalParameters
protected Map<String,org.ametys.web.frontoffice.search.SearchService.ParsedAdditionalParameterConf> _parseAndInjectDisplayAdditionalParameters(DefaultConfiguration containerConf)
Retrieve the configurations of additional parameters for 'Display' group, inject them into the group configuration and return their parsed representation.- Parameters:
containerConf
- The container configuration for injecting.- Returns:
- the
SearchService.ParsedAdditionalParameterConf
s
-
_buildAdditionalSearchServiceParameters
protected Collection<AdditionalSearchServiceParameter> _buildAdditionalSearchServiceParameters(Map<String,org.ametys.web.frontoffice.search.SearchService.ParsedAdditionalParameterConf> parsedAdditionalParameterConfs)
Build theAdditionalSearchServiceParameter
s from intermediateSearchService.ParsedAdditionalParameterConf
objects.- Parameters:
parsedAdditionalParameterConfs
- The parsed configurations for each additional parameter- Returns:
- the
AdditionalSearchServiceParameter
s
-
_setWidgetParameters
protected void _setWidgetParameters(String parameterName, List<String> fieldsReloadingCriteriaWidget)
Set the widget parameters of the given parameter, by adding the list of the fields reloading the widget- Parameters:
parameterName
- The parameter namefieldsReloadingCriteriaWidget
- the names of the fields which will launch a reload of the widget when their value change
-
_fieldsReloadingWidget
protected List<String> _fieldsReloadingWidget(Collection<AdditionalSearchServiceParameter> additionalParameters)
Gets the names of the fields which will launch a reload of this widget when their value change- Parameters:
additionalParameters
- The additional parameters- Returns:
- the names of the fields which will launch a reload of this widget when their value change
-
-