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_creationHelperThe helper component for defining this serviceprotected RenderingContextHandler_renderingContextHandlerThe handler of rendering contextprotected SearchServiceInstanceManager_searchServiceInstanceManagerThe manager forSearchServiceInstancestatic StringPARAM_NAME_COMPUTE_COUNTSThe parameter name for computing countsstatic StringPARAM_NAME_CONTEXTSThe parameter name for contextsstatic StringPARAM_NAME_CRITERIAThe parameter name for criteriastatic StringPARAM_NAME_FACETSThe parameter name for facetsstatic StringPARAM_NAME_HEADERThe parameter name for headerstatic StringPARAM_NAME_INITIAL_SORTSThe parameter name for initial sortsstatic StringPARAM_NAME_LAUNCH_SEARCH_AT_STARTUPThe parameter name for launching search at startupstatic StringPARAM_NAME_LINK_PAGEThe parameter name for link pagestatic StringPARAM_NAME_LINK_TITLEThe parameter name for link titlestatic StringPARAM_NAME_MAX_RESULTSThe parameter name for maximum number of resultsstatic StringPARAM_NAME_PROPOSED_SORTSThe parameter name for proposed sortsstatic StringPARAM_NAME_RESULT_PAGEThe parameter name for result pagestatic StringPARAM_NAME_RESULT_PLACEThe parameter name for result placestatic StringPARAM_NAME_RESULTS_PER_PAGEThe parameter name for number of results per pagestatic StringPARAM_NAME_RETURNABLESThe parameter name for returnablesstatic StringPARAM_NAME_RIGHT_CHECKING_MODEThe parameter name for right checking modestatic StringPARAM_NAME_RSSThe parameter name for handling RSSstatic StringPARAM_NAME_SAVE_USER_PREFSThe parameter name for saving user preferencesstatic StringPARAM_NAME_SERVICE_GROUP_IDThe parameter name for service group idstatic StringPARAM_NAME_XSLTThe parameter name for XSLTstatic StringROLEAvalon 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 theAdditionalSearchServiceParameters from intermediateSearchService.ParsedAdditionalParameterConfobjects.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 voidconfigureParameters(Configuration parametersConfiguration)Configure the service parametersstatic booleanhasUserCriteria(Optional<AbstractTreeNode<FOSearchCriterion>> criterionTree)Returnstrueif the given instance of search service has at least one user criterionstatic booleanhasUserInput(Optional<AbstractTreeNode<FOSearchCriterion>> criterionTree, Collection<FacetDefinition> facets, Collection<SortDefinition> proposedSorts)Returnstrueif the given instance of search service has some user inputbooleanisCacheable(Page currentPage, ZoneItem zoneItem)Returns true if the result of this service may be cached, depending on theZoneItemcontaining an instance of this service.voidservice(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:
servicein interfaceServiceable- Overrides:
servicein classStaticService- Throws:
ServiceException
-
hasUserInput
public static boolean hasUserInput(Optional<AbstractTreeNode<FOSearchCriterion>> criterionTree, Collection<FacetDefinition> facets, Collection<SortDefinition> proposedSorts)
Returnstrueif 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:
trueif the given instance of search service has some user input
-
hasUserCriteria
public static boolean hasUserCriteria(Optional<AbstractTreeNode<FOSearchCriterion>> criterionTree)
Returnstrueif the given instance of search service has at least one user criterion- Parameters:
criterionTree- The tree of criteria of the search service instance- Returns:
trueif the given instance of search service has at least one user criterion
-
isCacheable
public boolean isCacheable(Page currentPage, ZoneItem zoneItem)
Description copied from interface:ServiceReturns true if the result of this service may be cached, depending on theZoneItemcontaining an instance of this service.- Specified by:
isCacheablein interfaceService- Overrides:
isCacheablein classStaticService- Parameters:
currentPage- the currentPagecontaining the service.zoneItem- theZoneItemcontaining 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:StaticServiceConfigure the service parameters- Overrides:
configureParametersin 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.ParsedAdditionalParameterConfs
-
_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.ParsedAdditionalParameterConfs
-
_buildAdditionalSearchServiceParameters
protected Collection<AdditionalSearchServiceParameter> _buildAdditionalSearchServiceParameters(Map<String,org.ametys.web.frontoffice.search.SearchService.ParsedAdditionalParameterConf> parsedAdditionalParameterConfs)
Build theAdditionalSearchServiceParameters from intermediateSearchService.ParsedAdditionalParameterConfobjects.- Parameters:
parsedAdditionalParameterConfs- The parsed configurations for each additional parameter- Returns:
- the
AdditionalSearchServiceParameters
-
_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
-
-