Package org.ametys.cms.search.ui.model
Class SearchUIModelHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.cms.search.ui.model.SearchUIModelHelper
-
- All Implemented Interfaces:
LogEnabled,Component,Contextualizable,Serviceable
public class SearchUIModelHelper extends AbstractLogEnabled implements Component, Serviceable, Contextualizable
Client interaction helper forSearchUIModel.
-
-
Field Summary
Fields Modifier and Type Field Description private Context_contextprivate ContentTypeExtensionPoint_cTypeEPprivate SearchUIModelExtensionPoint_searchModelManagerprivate ServiceManager_serviceManagerstatic StringROLEThe component role.
-
Constructor Summary
Constructors Constructor Description SearchUIModelHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Map<I18nizableText,List<SearchUICriterion>>_getCriteriaByGroup(Map<String,? extends SearchUICriterion> criteria)private SearchUIModel_getModel(String modelId, List<String> restrictedContentTypes)private void_putCriterionParameter(Map<String,Object> jsonObject, SearchUICriterion criterion)private void_putEnumerator(Map<String,Object> jsonObject, Enumerator enumerator)private void_putValidator(Map<String,Object> jsonObject, Validator validator)voidcontextualize(Context context)Map<String,Object>getAdvancedCriteriaListInfo(Map<String,? extends SearchUICriterion> criteria)Return information on a list of advancedSearchUICriterion, serialized as a Map.Set<String>getAllContentTypes(SearchModel model, Map<String,Object> contextualParameters)Get all the real content types that a model works on (the included content types, minus the excluded types).List<Object>getColumnConfigurations(String modelId, List<String> restrictedContentTypes, Map<String,Object> contextualParameters)Get the column configurations of search model as JSON objectMap<String,Object>getColumnInfo(SearchUIColumn column)Return information on aSearchUIColumn, serialized as a Map.List<Object>getColumnListInfo(Map<String,? extends SearchUIColumn> columns)Return information on a list ofSearchUIColumn, serialized as a Map.Map<String,Object>getCriteriaListInfo(Map<String,? extends SearchUICriterion> criteria)Return information on a list ofSearchUICriterion, serialized as a Map.Map<String,Object>getCriterionInfo(SearchUICriterion criterion)Return information on aSearchUICriterion, serialized as a Map.Map<String,Object>getSearchModelConfiguration(String modelId, List<String> restrictedContentTypes, Map<String,Object> contextualParameters)Get the search model configuration as JSON objectMap<String,Object>getSearchModelInfo(SearchUIModel model, Map<String,Object> contextualParameters)Return information on aSearchUIModelobject serialized in a Map.voidservice(ServiceManager smanager)-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_searchModelManager
private SearchUIModelExtensionPoint _searchModelManager
-
_serviceManager
private ServiceManager _serviceManager
-
_cTypeEP
private ContentTypeExtensionPoint _cTypeEP
-
-
Constructor Detail
-
SearchUIModelHelper
public SearchUIModelHelper()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
getAllContentTypes
public Set<String> getAllContentTypes(SearchModel model, Map<String,Object> contextualParameters)
Get all the real content types that a model works on (the included content types, minus the excluded types).- Parameters:
model- the search model.contextualParameters- the contextual parameters.- Returns:
- a Set of the content type IDs.
-
getSearchModelConfiguration
public Map<String,Object> getSearchModelConfiguration(String modelId, List<String> restrictedContentTypes, Map<String,Object> contextualParameters) throws ProcessingException
Get the search model configuration as JSON object- Parameters:
modelId- The id of search modelrestrictedContentTypes- The restricted content types. Can be null.contextualParameters- the contextual parameters- Returns:
- The search model configuration in a Map
- Throws:
ProcessingException- if an error occurred
-
getColumnConfigurations
public List<Object> getColumnConfigurations(String modelId, List<String> restrictedContentTypes, Map<String,Object> contextualParameters) throws ProcessingException
Get the column configurations of search model as JSON object- Parameters:
modelId- The id of search modelrestrictedContentTypes- The restricted content types. Can be null.contextualParameters- the contextual parameters- Returns:
- The column configurations in a List
- Throws:
ProcessingException- if an error occurred
-
_getModel
private SearchUIModel _getModel(String modelId, List<String> restrictedContentTypes)
-
getSearchModelInfo
public Map<String,Object> getSearchModelInfo(SearchUIModel model, Map<String,Object> contextualParameters) throws ProcessingException
Return information on aSearchUIModelobject serialized in a Map.- Parameters:
model- The search model.contextualParameters- The contextual parameters- Returns:
- the detailed information serialized in a Map.
- Throws:
ProcessingException- if an error occurs.
-
getColumnListInfo
public List<Object> getColumnListInfo(Map<String,? extends SearchUIColumn> columns) throws ProcessingException
Return information on a list ofSearchUIColumn, serialized as a Map.- Parameters:
columns- the list of search columns.- Returns:
- the detailed information serialized in a Map.
- Throws:
ProcessingException- if an error occurs.
-
getColumnInfo
public Map<String,Object> getColumnInfo(SearchUIColumn column) throws ProcessingException
Return information on aSearchUIColumn, serialized as a Map.- Parameters:
column- the search column.- Returns:
- the detailed information serialized in a Map.
- Throws:
ProcessingException- if an error occurs.
-
getCriteriaListInfo
public Map<String,Object> getCriteriaListInfo(Map<String,? extends SearchUICriterion> criteria) throws ProcessingException
Return information on a list ofSearchUICriterion, serialized as a Map.- Parameters:
criteria- a map of search criteria.- Returns:
- the detailed information serialized in a Map.
- Throws:
ProcessingException- if an error occurs.
-
getAdvancedCriteriaListInfo
public Map<String,Object> getAdvancedCriteriaListInfo(Map<String,? extends SearchUICriterion> criteria) throws ProcessingException
Return information on a list of advancedSearchUICriterion, serialized as a Map.- Parameters:
criteria- A map of advanced search criteria.- Returns:
- the detailed information serialized in a Map.
- Throws:
ProcessingException- if an error occurs.
-
getCriterionInfo
public Map<String,Object> getCriterionInfo(SearchUICriterion criterion) throws ProcessingException
Return information on aSearchUICriterion, serialized as a Map.- Parameters:
criterion- a search criterion.- Returns:
- the detailed information serialized in a Map.
- Throws:
ProcessingException- if an error occurs.
-
_getCriteriaByGroup
private Map<I18nizableText,List<SearchUICriterion>> _getCriteriaByGroup(Map<String,? extends SearchUICriterion> criteria)
-
_putCriterionParameter
private void _putCriterionParameter(Map<String,Object> jsonObject, SearchUICriterion criterion) throws ProcessingException
- Throws:
ProcessingException
-
_putEnumerator
private void _putEnumerator(Map<String,Object> jsonObject, Enumerator enumerator) throws ProcessingException
- Throws:
ProcessingException
-
_putValidator
private void _putValidator(Map<String,Object> jsonObject, Validator validator)
-
-