Class SearchServiceCreationHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.frontoffice.search.metamodel.SearchServiceCreationHelper
-
- All Implemented Interfaces:
LogEnabled,PluginAware,Disposable,Initializable,Component,Contextualizable,Serviceable
public class SearchServiceCreationHelper extends AbstractLogEnabled implements Component, Serviceable, Initializable, Disposable, PluginAware, Contextualizable
Helper component for drawing search service creation/edition dialog box.
-
-
Field Summary
Fields Modifier and Type Field Description private Collection<AdditionalSearchServiceParameter>_additionalSearchServiceParametersprotected Context_contextThe contextprotected ContentTypeExtensionPoint_cTypeEPThe extension point for content typesprotected ThreadSafeComponentManager<Enumerator>_enumeratorManagerThe enumerator managerprivate boolean_initializedprotected ServiceManager_managerThe service managerprotected String_pluginNameThe plugin nameprotected ReturnableExtensionPoint_returnableEPThe extension point forReturnablesprotected SearchableExtensionPoint_searchableEPThe extension point forSearchablesprotected Map<Returnable,Collection<Searchable>>_searchablesByReturnableThe map returnable -> Collection of searchablesprotected ServiceExtensionPoint_serviceEPThe extension point for servicesprotected SiteEnumerator_siteEnumeratorTheSiteenumeratorprotected SiteQueryHelper_siteQueryHelperThe helper for site queryprotected SystemPropertyExtensionPoint_systemPropertyEPThe extension point forSystemPropertiesstatic StringROLEAvalon Role
-
Constructor Summary
Constructors Constructor Description SearchServiceCreationHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Collection<Configuration>_getAdditionalParameterConfigurationsOfReturnables()private Collection<Configuration>_getAdditionalParameterConfigurationsOfSearchables()private <T> Object_getAdditionalParameterValue(ModelAwareDataHolder serviceParameters, ServiceParameter<T> parameter)private Stream<Searchable>_getSearchables(Stream<Returnable> returnables)private void_logTree()private Set<String>_notDisplayableParameterIds(Collection<AdditionalSearchServiceParameter> additionalParameters)protected voidbuildTree()Method called at the start of the application based onReturnable.relationsWith()andSearchable.relationsWith()in order to build the data structure (in a map returnable -> Collection of searchables) linkingReturnables andSearchablesvoidcontextualize(Context context)protected voidcreateEnumerators()Creates and initializes enumerators (SiteEnumerator, etc.)voiddispose()Collection<Configuration>getAdditionalParameterConfigurationsForDisplay()Gets the configurations of the additional parameters to display in display groupCollection<Configuration>getAdditionalParameterConfigurationsForGeneral()Gets the configurations of the additional parameters to display in general groupCollection<AdditionalSearchServiceParameter>getAdditionalParameters()Gets the additional parameters to displayAdditionalParameterValueMapgetAdditionalParameterValues(Collection<AdditionalSearchServiceParameter> additionalParameters, Map<String,Object> clientSideValues)Gets the values of the additional parameters from a client formAdditionalParameterValueMapgetAdditionalParameterValues(Collection<AdditionalSearchServiceParameter> additionalParameters, ModelAwareDataHolder serviceParameters)Gets the values of the additional parametersMap<String,SearchCriterionDefinition>getCriterionDefinitions(Collection<Searchable> searchables, AdditionalParameterValueMap additionalParameterValues)Gets theSearchCriterionDefinitions available with the givenSearchables and additional parameter valuesMap<String,FacetDefinition>getFacetDefinitions(Collection<Returnable> returnables, AdditionalParameterValueMap additionalParameterValues)Gets theFacetDefinitions available with the givenReturnables and additional parameter valuesList<Returnable>getReturnables(List<String> returnableIds)Gets theReturnables with the given idsCollection<Searchable>getSearchables(Collection<Returnable> returnables)Gets theSearchables linked with the givenReturnablesMap<String,SortDefinition>getSortDefinitions(Collection<Returnable> returnables, AdditionalParameterValueMap additionalParameterValues)Gets theSortDefinitions available with the givenReturnables and additional parameter valuesvoidinitialize()booleanisReady()Is this creation helper ready ?Collection<String>selectedReturnables()Gets theReturnables that must be selected by defaultvoidservice(ServiceManager manager)voidsetAdditionalParameters(Collection<AdditionalSearchServiceParameter> additionalSearchServiceParameters)Sets the additional parameters to displayvoidsetPluginInfo(String pluginName, String featureName, String id)Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_manager
protected ServiceManager _manager
The service manager
-
_returnableEP
protected ReturnableExtensionPoint _returnableEP
The extension point forReturnables
-
_searchableEP
protected SearchableExtensionPoint _searchableEP
The extension point forSearchables
-
_serviceEP
protected ServiceExtensionPoint _serviceEP
The extension point for services
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The extension point for content types
-
_systemPropertyEP
protected SystemPropertyExtensionPoint _systemPropertyEP
The extension point forSystemProperties
-
_siteQueryHelper
protected SiteQueryHelper _siteQueryHelper
The helper for site query
-
_enumeratorManager
protected ThreadSafeComponentManager<Enumerator> _enumeratorManager
The enumerator manager
-
_siteEnumerator
protected SiteEnumerator _siteEnumerator
TheSiteenumerator
-
_pluginName
protected String _pluginName
The plugin name
-
_searchablesByReturnable
protected Map<Returnable,Collection<Searchable>> _searchablesByReturnable
The map returnable -> Collection of searchables
-
_additionalSearchServiceParameters
private Collection<AdditionalSearchServiceParameter> _additionalSearchServiceParameters
-
_initialized
private boolean _initialized
-
-
Constructor Detail
-
SearchServiceCreationHelper
public SearchServiceCreationHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAwareSets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfoin interfacePluginAware- Parameters:
pluginName- Unique identifier for the plugin hosting the extensionfeatureName- Unique feature identifier (unique for a given pluginName)id- Unique identifier of this component
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
initialize
public void initialize() throws Exception
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
dispose
public void dispose()
- Specified by:
disposein interfaceDisposable
-
isReady
public boolean isReady()
Is this creation helper ready ?- Returns:
trueif this creation helper is ready
-
buildTree
protected void buildTree()
Method called at the start of the application based onReturnable.relationsWith()andSearchable.relationsWith()in order to build the data structure (in a map returnable -> Collection of searchables) linkingReturnables andSearchables
-
_logTree
private void _logTree()
-
createEnumerators
protected void createEnumerators() throws Exception
Creates and initializes enumerators (SiteEnumerator, etc.)- Throws:
Exception- if an error occurs
-
getReturnables
public List<Returnable> getReturnables(List<String> returnableIds)
Gets theReturnables with the given ids- Parameters:
returnableIds- the ids of theReturnables- Returns:
- the
Returnables with the given ids
-
getSearchables
public Collection<Searchable> getSearchables(Collection<Returnable> returnables)
Gets theSearchables linked with the givenReturnables- Parameters:
returnables- theReturnables- Returns:
- the
Searchables linked with the givenReturnable
-
_getSearchables
private Stream<Searchable> _getSearchables(Stream<Returnable> returnables)
-
getCriterionDefinitions
public Map<String,SearchCriterionDefinition> getCriterionDefinitions(Collection<Searchable> searchables, AdditionalParameterValueMap additionalParameterValues)
Gets theSearchCriterionDefinitions available with the givenSearchables and additional parameter values- Parameters:
searchables- TheSearchablesadditionalParameterValues- The additional parameter values- Returns:
- the
SearchCriterionDefinitions available with the givenSearchables and additional parameter values
-
getFacetDefinitions
public Map<String,FacetDefinition> getFacetDefinitions(Collection<Returnable> returnables, AdditionalParameterValueMap additionalParameterValues)
Gets theFacetDefinitions available with the givenReturnables and additional parameter values- Parameters:
returnables- TheReturnablesadditionalParameterValues- The additional parameter values- Returns:
- the
FacetDefinitions available with the givenReturnables and additional parameter values
-
getSortDefinitions
public Map<String,SortDefinition> getSortDefinitions(Collection<Returnable> returnables, AdditionalParameterValueMap additionalParameterValues)
Gets theSortDefinitions available with the givenReturnables and additional parameter values- Parameters:
returnables- TheReturnablesadditionalParameterValues- The additional parameter values- Returns:
- the
SortDefinitions available with the givenReturnables and additional parameter values
-
selectedReturnables
public Collection<String> selectedReturnables()
Gets theReturnables that must be selected by default- Returns:
- the
Returnables that must be selected by default
-
getAdditionalParameterConfigurationsForGeneral
public Collection<Configuration> getAdditionalParameterConfigurationsForGeneral()
Gets the configurations of the additional parameters to display in general group- Returns:
- the configurations of the additional parameters to display
-
_getAdditionalParameterConfigurationsOfSearchables
private Collection<Configuration> _getAdditionalParameterConfigurationsOfSearchables()
-
getAdditionalParameterConfigurationsForDisplay
public Collection<Configuration> getAdditionalParameterConfigurationsForDisplay()
Gets the configurations of the additional parameters to display in display group- Returns:
- the configurations of the additional parameters to display
-
_getAdditionalParameterConfigurationsOfReturnables
private Collection<Configuration> _getAdditionalParameterConfigurationsOfReturnables()
-
setAdditionalParameters
public void setAdditionalParameters(Collection<AdditionalSearchServiceParameter> additionalSearchServiceParameters)
Sets the additional parameters to display- Parameters:
additionalSearchServiceParameters- the additional parameters to display
-
getAdditionalParameters
public Collection<AdditionalSearchServiceParameter> getAdditionalParameters()
Gets the additional parameters to display- Returns:
- the additional parameters to display
-
getAdditionalParameterValues
public AdditionalParameterValueMap getAdditionalParameterValues(Collection<AdditionalSearchServiceParameter> additionalParameters, ModelAwareDataHolder serviceParameters)
Gets the values of the additional parameters- Parameters:
additionalParameters- the additional parametersserviceParameters- the storage of the service parameters- Returns:
- the values of the additional parameters
-
_getAdditionalParameterValue
private <T> Object _getAdditionalParameterValue(ModelAwareDataHolder serviceParameters, ServiceParameter<T> parameter)
-
getAdditionalParameterValues
public AdditionalParameterValueMap getAdditionalParameterValues(Collection<AdditionalSearchServiceParameter> additionalParameters, Map<String,Object> clientSideValues)
Gets the values of the additional parameters from a client form- Parameters:
additionalParameters- the additional parametersclientSideValues- the values of the client form- Returns:
- the values of the additional parameters from the client form
-
_notDisplayableParameterIds
private Set<String> _notDisplayableParameterIds(Collection<AdditionalSearchServiceParameter> additionalParameters)
-
-