Package org.ametys.cms.search.ui.model
Class AbstractSearchUIModel
- java.lang.Object
-
- org.ametys.cms.search.ui.model.AbstractSearchUIModel
-
- All Implemented Interfaces:
SearchModel,SearchUIModel,LogEnabled,Contextualizable,Serviceable
- Direct Known Subclasses:
CriteriaSearchUIModelWrapper,ReferenceTableSearchUIModel,ReferencingContentsWithSameValuesSearchUIModel,StaticSearchUIModel
public abstract class AbstractSearchUIModel extends Object implements SearchUIModel, LogEnabled, Serviceable, Contextualizable
Abstract class for SearchUIModel.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,SearchUICriterion>_advancedSearchCriteriaThe search criteria in advanced mode, indexed by ID.protected Map<String,SearchUIColumn>_columnsThe result columns, indexed by ID.protected Context_contextThe context.protected ContentTypeExtensionPoint_cTypeEPThe content type extension pointprotected Set<String>_cTypesThe content types of this search model.protected Set<String>_excludedCTypesThe content types excluded from this search model.protected Map<String,SearchUICriterion>_facetedCriteriaThe search criteria used as facets, indexed by ID.protected org.slf4j.Logger_loggerThe logger.protected ServiceManager_managerThe service managerprotected Map<String,SearchUICriterion>_searchCriteriaThe search criteria in simple mode, indexed by ID.protected SearchUIModelHelper_searchModelHelperThe search model helper.
-
Constructor Summary
Constructors Constructor Description AbstractSearchUIModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddContentTypesConfiguration(DefaultConfiguration conf, Set<String> baseContentTypeIds)Add the content types configuration.voidcontextualize(Context context)Map<String,SearchUICriterion>getAdvancedCriteria(Map<String,Object> contextualParameters)Get the list of search criteria in advanced modeSet<String>getContentTypes(Map<String,Object> contextualParameters)Get the list of content types.Map<String,SearchUICriterion>getCriteria(Map<String,Object> contextualParameters)Get the list of search criteria in simple modeprotected ConfigurationgetCustomCriteriaConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String customCriterionId, I18nizableText group)Get the configuration of a custom criteria component.Set<String>getExcludedContentTypes(Map<String,Object> contextualParameters)Get the list of excluded content types.StringgetExportCSVUrl(Map<String,Object> contextualParameters)Get the URL for CVS export of resultsStringgetExportCSVUrlPlugin(Map<String,Object> contextualParameters)Get the plugin name for CVS export of resultsStringgetExportDOCUrl(Map<String,Object> contextualParameters)Get the URL for DOC export of resultsStringgetExportDOCUrlPlugin(Map<String,Object> contextualParameters)Get the plugin name for DOC export of resultsStringgetExportXMLUrl(Map<String,Object> contextualParameters)Get the URL for XML export of resultsStringgetExportXMLUrlPlugin(Map<String,Object> contextualParameters)Get the plugin name for XML export of resultsMap<String,SearchUICriterion>getFacetedCriteria(Map<String,Object> contextualParameters)Get the list of faceted search criteria.protected ConfigurationgetIndexingFieldCriteriaConfiguration(Set<String> baseContentTypeIds, String path, Query.Operator operator)Get the configuration of a metadata criteria component.protected ConfigurationgetIndexingFieldCriteriaConfiguration(Set<String> baseContentTypeIds, String path, Query.Operator operator, I18nizableText group)Get the configuration of a metadata criteria component.protected ConfigurationgetIndexingFieldCriteriaConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String path, Query.Operator operator, I18nizableText group)Get the configuration of a metadata criteria component.protected org.slf4j.LoggergetLogger()Get the logger.protected ConfigurationgetMetadataColumnConfiguration(Set<String> baseContentTypeIds, String metadataPath)Get the configuration of a metadata column component.protected ConfigurationgetMetadataColumnConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String metadataPath)Get the configuration of a metadata column component.intgetPageSize(Map<String,Object> contextualParameters)Get the page size.StringgetPrintUrl(Map<String,Object> contextualParameters)Get the URL for print resultsStringgetPrintUrlPlugin(Map<String,Object> contextualParameters)Get the plugin name for print resultsMap<String,SearchUIColumn>getResultFields(Map<String,Object> contextualParameters)Get the column for resultsStringgetSearchUrl(Map<String,Object> contextualParameters)Get the URL for searchStringgetSearchUrlPlugin(Map<String,Object> contextualParameters)Get the plugin name for searchStringgetSummaryView()Get the name of the view to use for summary of the content.protected ConfigurationgetSystemColumnConfiguration(Set<String> baseContentTypeIds, String property)Get the configuration of a system column component.protected ConfigurationgetSystemColumnConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String property)Get the configuration of a system column component.protected ConfigurationgetSystemCriteriaConfiguration(Set<String> baseContentTypeIds, String property)Get the configuration of a system criteria component.protected ConfigurationgetSystemCriteriaConfiguration(Set<String> baseContentTypeIds, String property, I18nizableText group)Get the configuration of a system criteria component.protected ConfigurationgetSystemCriteriaConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String property, I18nizableText group)Get the configuration of a system criteria component.StringgetWorkspace(Map<String,Object> contextualParameters)Get the specific workspace to use.voidservice(ServiceManager manager)voidsetAdvancedCriteria(Collection<SearchUICriterion> criteria)Set the criteria in advanced mode.voidsetContentTypes(Set<String> cTypes)Set the content types.voidsetCriteria(Collection<SearchUICriterion> criteria)Set the criteria in simple mode.voidsetExcludedContentTypes(Set<String> cTypes)Set the excluded content types.voidsetFacetedCriteria(Collection<SearchCriterion> criteria)Set the criteria to use as facets.voidsetLogger(org.slf4j.Logger logger)Called at creation time to provide aLogger.voidsetResultFields(Collection<SearchUIColumn> fields)Set the result columns.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.cms.search.ui.model.SearchUIModel
allowSortOnMultipleJoin, getAdvancedCriterion, getCriterion, getFacetedCriterion, getResultField
-
-
-
-
Field Detail
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The content type extension point
-
_searchModelHelper
protected SearchUIModelHelper _searchModelHelper
The search model helper.
-
_logger
protected org.slf4j.Logger _logger
The logger.
-
_manager
protected ServiceManager _manager
The service manager
-
_excludedCTypes
protected Set<String> _excludedCTypes
The content types excluded from this search model.
-
_searchCriteria
protected Map<String,SearchUICriterion> _searchCriteria
The search criteria in simple mode, indexed by ID.
-
_advancedSearchCriteria
protected Map<String,SearchUICriterion> _advancedSearchCriteria
The search criteria in advanced mode, indexed by ID.
-
_facetedCriteria
protected Map<String,SearchUICriterion> _facetedCriteria
The search criteria used as facets, indexed by ID.
-
_columns
protected Map<String,SearchUIColumn> _columns
The result columns, indexed by ID.
-
-
Constructor Detail
-
AbstractSearchUIModel
public AbstractSearchUIModel()
-
-
Method Detail
-
setLogger
public void setLogger(org.slf4j.Logger logger)
Description copied from interface:LogEnabledCalled at creation time to provide aLogger.- Specified by:
setLoggerin interfaceLogEnabled- Parameters:
logger- aLoggerfor messages.
-
getLogger
protected final org.slf4j.Logger getLogger()
Get the logger.- Returns:
- the logger.
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getContentTypes
public Set<String> getContentTypes(Map<String,Object> contextualParameters)
Description copied from interface:SearchModelGet the list of content types.- Specified by:
getContentTypesin interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters.- Returns:
- The list of content types.
-
setContentTypes
public void setContentTypes(Set<String> cTypes)
Set the content types.- Parameters:
cTypes- The content types.
-
getExcludedContentTypes
public Set<String> getExcludedContentTypes(Map<String,Object> contextualParameters)
Description copied from interface:SearchModelGet the list of excluded content types.- Specified by:
getExcludedContentTypesin interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- The list of excluded content types.
-
setExcludedContentTypes
public void setExcludedContentTypes(Set<String> cTypes)
Set the excluded content types.- Parameters:
cTypes- The excluded content types.
-
getCriteria
public Map<String,SearchUICriterion> getCriteria(Map<String,Object> contextualParameters)
Description copied from interface:SearchModelGet the list of search criteria in simple mode- Specified by:
getCriteriain interfaceSearchModel- Specified by:
getCriteriain interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the list of search criteria in simple mode
-
setCriteria
public void setCriteria(Collection<SearchUICriterion> criteria)
Set the criteria in simple mode.- Parameters:
criteria- A collection of search criteria.
-
getAdvancedCriteria
public Map<String,SearchUICriterion> getAdvancedCriteria(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the list of search criteria in advanced mode- Specified by:
getAdvancedCriteriain interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the list of search criteria in advanced mode
-
setAdvancedCriteria
public void setAdvancedCriteria(Collection<SearchUICriterion> criteria)
Set the criteria in advanced mode.- Parameters:
criteria- A collection of search criteria.
-
getFacetedCriteria
public Map<String,SearchUICriterion> getFacetedCriteria(Map<String,Object> contextualParameters)
Description copied from interface:SearchModelGet the list of faceted search criteria.- Specified by:
getFacetedCriteriain interfaceSearchModel- Specified by:
getFacetedCriteriain interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the list of faceted search criteria.
-
setFacetedCriteria
public void setFacetedCriteria(Collection<SearchCriterion> criteria)
Set the criteria to use as facets.- Parameters:
criteria- A collection of search criteria.
-
getResultFields
public Map<String,SearchUIColumn> getResultFields(Map<String,Object> contextualParameters)
Description copied from interface:SearchModelGet the column for results- Specified by:
getResultFieldsin interfaceSearchModel- Specified by:
getResultFieldsin interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters. Can be null.- Returns:
- the column for results
-
setResultFields
public void setResultFields(Collection<SearchUIColumn> fields)
Set the result columns.- Parameters:
fields- A collection of search columns.
-
getPageSize
public int getPageSize(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the page size.- Specified by:
getPageSizein interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters.- Returns:
- The page size, unlimited or default used when negative or 0.
-
getWorkspace
public String getWorkspace(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the specific workspace to use.- Specified by:
getWorkspacein interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters.- Returns:
- the workspace to use when searching, or null to use the default workspace.
-
getSearchUrl
public String getSearchUrl(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the URL for search- Specified by:
getSearchUrlin interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the URL for search
-
getSearchUrlPlugin
public String getSearchUrlPlugin(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the plugin name for search- Specified by:
getSearchUrlPluginin interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the plugin name for search
-
getExportCSVUrl
public String getExportCSVUrl(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the URL for CVS export of results- Specified by:
getExportCSVUrlin interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the URL for CVS export
-
getExportCSVUrlPlugin
public String getExportCSVUrlPlugin(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the plugin name for CVS export of results- Specified by:
getExportCSVUrlPluginin interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the plugin name for CVS export
-
getExportDOCUrl
public String getExportDOCUrl(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the URL for DOC export of results- Specified by:
getExportDOCUrlin interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the URL for CVS export
-
getExportDOCUrlPlugin
public String getExportDOCUrlPlugin(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the plugin name for DOC export of results- Specified by:
getExportDOCUrlPluginin interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the plugin name for CVS export
-
getExportXMLUrl
public String getExportXMLUrl(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the URL for XML export of results- Specified by:
getExportXMLUrlin interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the URL for XML export
-
getExportXMLUrlPlugin
public String getExportXMLUrlPlugin(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the plugin name for XML export of results- Specified by:
getExportXMLUrlPluginin interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the plugin name for XML export
-
getPrintUrl
public String getPrintUrl(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the URL for print results- Specified by:
getPrintUrlin interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the URL for print results
-
getPrintUrlPlugin
public String getPrintUrlPlugin(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the plugin name for print results- Specified by:
getPrintUrlPluginin interfaceSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the plugin name for print results
-
getSummaryView
public String getSummaryView()
Description copied from interface:SearchUIModelGet the name of the view to use for summary of the content.- Specified by:
getSummaryViewin interfaceSearchUIModel- Returns:
- the name of the view to use for summary of the content. Can be null.
-
getIndexingFieldCriteriaConfiguration
protected Configuration getIndexingFieldCriteriaConfiguration(Set<String> baseContentTypeIds, String path, Query.Operator operator) throws ConfigurationException
Get the configuration of a metadata criteria component.- Parameters:
baseContentTypeIds- the "base" content type identifiers.path- the field path.operator- the criteria operator, can be null.- Returns:
- the configuration to provide to the metadata criteria component.
- Throws:
ConfigurationException- if an error occurs.
-
getIndexingFieldCriteriaConfiguration
protected Configuration getIndexingFieldCriteriaConfiguration(Set<String> baseContentTypeIds, String path, Query.Operator operator, I18nizableText group) throws ConfigurationException
Get the configuration of a metadata criteria component.- Parameters:
baseContentTypeIds- the "base" content type identifiers.path- the field path.operator- the criteria operator, can be null.group- The group. Can be null.- Returns:
- the configuration to provide to the metadata criteria component.
- Throws:
ConfigurationException- if an error occurs.
-
getIndexingFieldCriteriaConfiguration
protected Configuration getIndexingFieldCriteriaConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String path, Query.Operator operator, I18nizableText group) throws ConfigurationException
Get the configuration of a metadata criteria component.- Parameters:
originalConf- the original criteria configuration.baseContentTypeIds- the "base" content type identifiers.path- the field path, separated by '/'.operator- the criteria operator, can be null.group- The group. Can be null.- Returns:
- the configuration to provide to the metadata criterion component.
- Throws:
ConfigurationException- if an error occurs.
-
getSystemCriteriaConfiguration
protected Configuration getSystemCriteriaConfiguration(Set<String> baseContentTypeIds, String property)
Get the configuration of a system criteria component.- Parameters:
baseContentTypeIds- the "base" content type identifiers.property- the system property.- Returns:
- the configuration to provide to the system criterion component.
-
getSystemCriteriaConfiguration
protected Configuration getSystemCriteriaConfiguration(Set<String> baseContentTypeIds, String property, I18nizableText group)
Get the configuration of a system criteria component.- Parameters:
baseContentTypeIds- the "base" content type identifiers.property- the system property.group- The group. Can be null.- Returns:
- the configuration to provide to the system criterion component.
-
getSystemCriteriaConfiguration
protected Configuration getSystemCriteriaConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String property, I18nizableText group) throws ConfigurationException
Get the configuration of a system criteria component.- Parameters:
originalConf- the original column configuration.baseContentTypeIds- the "base" content type identifiers.property- the system property.group- The group. Can be null.- Returns:
- the configuration to provide to the system criterion component.
- Throws:
ConfigurationException- if an error occurs.
-
getCustomCriteriaConfiguration
protected Configuration getCustomCriteriaConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String customCriterionId, I18nizableText group) throws ConfigurationException
Get the configuration of a custom criteria component.- Parameters:
originalConf- the original column configuration.baseContentTypeIds- the "base" content type identifiers.customCriterionId- the custom criterion idgroup- The group. Can be null.- Returns:
- the configuration to provide to the custom criterion component.
- Throws:
ConfigurationException- if an error occurs.
-
getMetadataColumnConfiguration
protected Configuration getMetadataColumnConfiguration(Set<String> baseContentTypeIds, String metadataPath) throws ConfigurationException
Get the configuration of a metadata column component.- Parameters:
baseContentTypeIds- the "base" content type identifiers.metadataPath- the metadata path.- Returns:
- the configuration to provide to the metadata column component.
- Throws:
ConfigurationException- if an error occurs.
-
getMetadataColumnConfiguration
protected Configuration getMetadataColumnConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String metadataPath) throws ConfigurationException
Get the configuration of a metadata column component.- Parameters:
originalConf- the original column configuration.baseContentTypeIds- the base content type identifiers.metadataPath- the metadata path.- Returns:
- the configuration to provide to the metadata column component.
- Throws:
ConfigurationException- if an error occurs.
-
getSystemColumnConfiguration
protected Configuration getSystemColumnConfiguration(Set<String> baseContentTypeIds, String property) throws ConfigurationException
Get the configuration of a system column component.- Parameters:
baseContentTypeIds- the "base" content type identifiers.property- the system property.- Returns:
- the configuration to provide to the system column component.
- Throws:
ConfigurationException- if an error occurs.
-
getSystemColumnConfiguration
protected Configuration getSystemColumnConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String property) throws ConfigurationException
Get the configuration of a system column component.- Parameters:
originalConf- the original column configuration.baseContentTypeIds- the "base" content type identifiers.property- the system property.- Returns:
- the configuration to provide to the system column component.
- Throws:
ConfigurationException- if an error occurs.
-
addContentTypesConfiguration
protected void addContentTypesConfiguration(DefaultConfiguration conf, Set<String> baseContentTypeIds)
Add the content types configuration.- Parameters:
conf- The configuration to write to.baseContentTypeIds- The "base" content type identifiers.
-
-