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>
_additionalSearchServiceParameters
protected Context
_context
The contextprotected ContentTypeExtensionPoint
_cTypeEP
The extension point for content typesprotected ThreadSafeComponentManager<Enumerator>
_enumeratorManager
The enumerator managerprivate boolean
_initialized
protected ServiceManager
_manager
The service managerprotected String
_pluginName
The plugin nameprotected ReturnableExtensionPoint
_returnableEP
The extension point forReturnable
sprotected SearchableExtensionPoint
_searchableEP
The extension point forSearchable
sprotected Map<Returnable,Collection<Searchable>>
_searchablesByReturnable
The map returnable -> Collection of searchablesprotected ServiceExtensionPoint
_serviceEP
The extension point for servicesprotected SiteEnumerator
_siteEnumerator
TheSite
enumeratorprotected SiteQueryHelper
_siteQueryHelper
The helper for site queryprotected SystemPropertyExtensionPoint
_systemPropertyEP
The extension point forSystemProperties
static String
ROLE
Avalon 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 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) linkingReturnable
s andSearchable
svoid
contextualize(Context context)
protected void
createEnumerators()
Creates and initializes enumerators (SiteEnumerator
, etc.)void
dispose()
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 displayAdditionalParameterValueMap
getAdditionalParameterValues(Collection<AdditionalSearchServiceParameter> additionalParameters, Map<String,Object> clientSideValues)
Gets the values of the additional parameters from a client formAdditionalParameterValueMap
getAdditionalParameterValues(Collection<AdditionalSearchServiceParameter> additionalParameters, ModelAwareDataHolder serviceParameters)
Gets the values of the additional parametersMap<String,SearchCriterionDefinition>
getCriterionDefinitions(Collection<Searchable> searchables, AdditionalParameterValueMap additionalParameterValues)
Gets theSearchCriterionDefinition
s available with the givenSearchable
s and additional parameter valuesMap<String,FacetDefinition>
getFacetDefinitions(Collection<Returnable> returnables, AdditionalParameterValueMap additionalParameterValues)
Gets theFacetDefinition
s available with the givenReturnable
s and additional parameter valuesList<Returnable>
getReturnables(List<String> returnableIds)
Gets theReturnable
s with the given idsCollection<Searchable>
getSearchables(Collection<Returnable> returnables)
Gets theSearchable
s linked with the givenReturnable
sMap<String,SortDefinition>
getSortDefinitions(Collection<Returnable> returnables, AdditionalParameterValueMap additionalParameterValues)
Gets theSortDefinition
s available with the givenReturnable
s and additional parameter valuesvoid
initialize()
boolean
isReady()
Is this creation helper ready ?Collection<String>
selectedReturnables()
Gets theReturnable
s that must be selected by defaultvoid
service(ServiceManager manager)
void
setAdditionalParameters(Collection<AdditionalSearchServiceParameter> additionalSearchServiceParameters)
Sets the additional parameters to displayvoid
setPluginInfo(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 forReturnable
s
-
_searchableEP
protected SearchableExtensionPoint _searchableEP
The extension point forSearchable
s
-
_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
TheSite
enumerator
-
_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:
service
in interfaceServiceable
- Throws:
ServiceException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
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.- Specified by:
setPluginInfo
in 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:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceDisposable
-
isReady
public boolean isReady()
Is this creation helper ready ?- Returns:
true
if 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) linkingReturnable
s andSearchable
s
-
_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 theReturnable
s with the given ids- Parameters:
returnableIds
- the ids of theReturnable
s- Returns:
- the
Returnable
s with the given ids
-
getSearchables
public Collection<Searchable> getSearchables(Collection<Returnable> returnables)
Gets theSearchable
s linked with the givenReturnable
s- Parameters:
returnables
- theReturnable
s- Returns:
- the
Searchable
s linked with the givenReturnable
-
_getSearchables
private Stream<Searchable> _getSearchables(Stream<Returnable> returnables)
-
getCriterionDefinitions
public Map<String,SearchCriterionDefinition> getCriterionDefinitions(Collection<Searchable> searchables, AdditionalParameterValueMap additionalParameterValues)
Gets theSearchCriterionDefinition
s available with the givenSearchable
s and additional parameter values- Parameters:
searchables
- TheSearchable
sadditionalParameterValues
- The additional parameter values- Returns:
- the
SearchCriterionDefinition
s available with the givenSearchable
s and additional parameter values
-
getFacetDefinitions
public Map<String,FacetDefinition> getFacetDefinitions(Collection<Returnable> returnables, AdditionalParameterValueMap additionalParameterValues)
Gets theFacetDefinition
s available with the givenReturnable
s and additional parameter values- Parameters:
returnables
- TheReturnable
sadditionalParameterValues
- The additional parameter values- Returns:
- the
FacetDefinition
s available with the givenReturnable
s and additional parameter values
-
getSortDefinitions
public Map<String,SortDefinition> getSortDefinitions(Collection<Returnable> returnables, AdditionalParameterValueMap additionalParameterValues)
Gets theSortDefinition
s available with the givenReturnable
s and additional parameter values- Parameters:
returnables
- TheReturnable
sadditionalParameterValues
- The additional parameter values- Returns:
- the
SortDefinition
s available with the givenReturnable
s and additional parameter values
-
selectedReturnables
public Collection<String> selectedReturnables()
Gets theReturnable
s that must be selected by default- Returns:
- the
Returnable
s 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)
-
-