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>
_advancedSearchCriteria
The search criteria in advanced mode, indexed by ID.protected Map<String,SearchUIColumn>
_columns
The result columns, indexed by ID.protected Context
_context
The context.protected ContentTypeExtensionPoint
_cTypeEP
The content type extension pointprotected Set<String>
_cTypes
The content types of this search model.protected Set<String>
_excludedCTypes
The content types excluded from this search model.protected Map<String,SearchUICriterion>
_facetedCriteria
The search criteria used as facets, indexed by ID.protected org.slf4j.Logger
_logger
The logger.protected ServiceManager
_manager
The service managerprotected Map<String,SearchUICriterion>
_searchCriteria
The search criteria in simple mode, indexed by ID.protected SearchUIModelHelper
_searchModelHelper
The search model helper.
-
Constructor Summary
Constructors Constructor Description AbstractSearchUIModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addContentTypesConfiguration(DefaultConfiguration conf, Set<String> baseContentTypeIds)
Add the content types configuration.void
contextualize(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 Configuration
getCustomCriteriaConfiguration(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.String
getExportCSVUrl(Map<String,Object> contextualParameters)
Get the URL for CVS export of resultsString
getExportCSVUrlPlugin(Map<String,Object> contextualParameters)
Get the plugin name for CVS export of resultsString
getExportDOCUrl(Map<String,Object> contextualParameters)
Get the URL for DOC export of resultsString
getExportDOCUrlPlugin(Map<String,Object> contextualParameters)
Get the plugin name for DOC export of resultsString
getExportXMLUrl(Map<String,Object> contextualParameters)
Get the URL for XML export of resultsString
getExportXMLUrlPlugin(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 Configuration
getIndexingFieldCriteriaConfiguration(Set<String> baseContentTypeIds, String path, Query.Operator operator)
Get the configuration of a metadata criteria component.protected Configuration
getIndexingFieldCriteriaConfiguration(Set<String> baseContentTypeIds, String path, Query.Operator operator, I18nizableText group)
Get the configuration of a metadata criteria component.protected Configuration
getIndexingFieldCriteriaConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String path, Query.Operator operator, I18nizableText group)
Get the configuration of a metadata criteria component.protected org.slf4j.Logger
getLogger()
Get the logger.protected Configuration
getMetadataColumnConfiguration(Set<String> baseContentTypeIds, String metadataPath)
Get the configuration of a metadata column component.protected Configuration
getMetadataColumnConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String metadataPath)
Get the configuration of a metadata column component.int
getPageSize(Map<String,Object> contextualParameters)
Get the page size.String
getPrintUrl(Map<String,Object> contextualParameters)
Get the URL for print resultsString
getPrintUrlPlugin(Map<String,Object> contextualParameters)
Get the plugin name for print resultsMap<String,SearchUIColumn>
getResultFields(Map<String,Object> contextualParameters)
Get the column for resultsString
getSearchUrl(Map<String,Object> contextualParameters)
Get the URL for searchString
getSearchUrlPlugin(Map<String,Object> contextualParameters)
Get the plugin name for searchString
getSummaryView()
Get the name of the view to use for summary of the content.protected Configuration
getSystemColumnConfiguration(Set<String> baseContentTypeIds, String property)
Get the configuration of a system column component.protected Configuration
getSystemColumnConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String property)
Get the configuration of a system column component.protected Configuration
getSystemCriteriaConfiguration(Set<String> baseContentTypeIds, String property)
Get the configuration of a system criteria component.protected Configuration
getSystemCriteriaConfiguration(Set<String> baseContentTypeIds, String property, I18nizableText group)
Get the configuration of a system criteria component.protected Configuration
getSystemCriteriaConfiguration(Configuration originalConf, Set<String> baseContentTypeIds, String property, I18nizableText group)
Get the configuration of a system criteria component.String
getWorkspace(Map<String,Object> contextualParameters)
Get the specific workspace to use.void
service(ServiceManager manager)
void
setAdvancedCriteria(Collection<SearchUICriterion> criteria)
Set the criteria in advanced mode.void
setContentTypes(Set<String> cTypes)
Set the content types.void
setCriteria(Collection<SearchUICriterion> criteria)
Set the criteria in simple mode.void
setExcludedContentTypes(Set<String> cTypes)
Set the excluded content types.void
setFacetedCriteria(Collection<SearchCriterion> criteria)
Set the criteria to use as facets.void
setLogger(org.slf4j.Logger logger)
Called at creation time to provide aLogger
.void
setResultFields(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:LogEnabled
Called at creation time to provide aLogger
.- Specified by:
setLogger
in interfaceLogEnabled
- Parameters:
logger
- aLogger
for messages.
-
getLogger
protected final org.slf4j.Logger getLogger()
Get the logger.- Returns:
- the logger.
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getContentTypes
public Set<String> getContentTypes(Map<String,Object> contextualParameters)
Description copied from interface:SearchModel
Get the list of content types.- Specified by:
getContentTypes
in 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:SearchModel
Get the list of excluded content types.- Specified by:
getExcludedContentTypes
in 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:SearchModel
Get the list of search criteria in simple mode- Specified by:
getCriteria
in interfaceSearchModel
- Specified by:
getCriteria
in 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:SearchUIModel
Get the list of search criteria in advanced mode- Specified by:
getAdvancedCriteria
in 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:SearchModel
Get the list of faceted search criteria.- Specified by:
getFacetedCriteria
in interfaceSearchModel
- Specified by:
getFacetedCriteria
in 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:SearchModel
Get the column for results- Specified by:
getResultFields
in interfaceSearchModel
- Specified by:
getResultFields
in 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:SearchUIModel
Get the page size.- Specified by:
getPageSize
in 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:SearchUIModel
Get the specific workspace to use.- Specified by:
getWorkspace
in 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:SearchUIModel
Get the URL for search- Specified by:
getSearchUrl
in interfaceSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the URL for search
-
getSearchUrlPlugin
public String getSearchUrlPlugin(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModel
Get the plugin name for search- Specified by:
getSearchUrlPlugin
in interfaceSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the plugin name for search
-
getExportCSVUrl
public String getExportCSVUrl(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModel
Get the URL for CVS export of results- Specified by:
getExportCSVUrl
in interfaceSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the URL for CVS export
-
getExportCSVUrlPlugin
public String getExportCSVUrlPlugin(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModel
Get the plugin name for CVS export of results- Specified by:
getExportCSVUrlPlugin
in 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:SearchUIModel
Get the URL for DOC export of results- Specified by:
getExportDOCUrl
in interfaceSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the URL for CVS export
-
getExportDOCUrlPlugin
public String getExportDOCUrlPlugin(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModel
Get the plugin name for DOC export of results- Specified by:
getExportDOCUrlPlugin
in 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:SearchUIModel
Get the URL for XML export of results- Specified by:
getExportXMLUrl
in interfaceSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the URL for XML export
-
getExportXMLUrlPlugin
public String getExportXMLUrlPlugin(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModel
Get the plugin name for XML export of results- Specified by:
getExportXMLUrlPlugin
in 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:SearchUIModel
Get the URL for print results- Specified by:
getPrintUrl
in interfaceSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the URL for print results
-
getPrintUrlPlugin
public String getPrintUrlPlugin(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModel
Get the plugin name for print results- Specified by:
getPrintUrlPlugin
in interfaceSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the plugin name for print results
-
getSummaryView
public String getSummaryView()
Description copied from interface:SearchUIModel
Get the name of the view to use for summary of the content.- Specified by:
getSummaryView
in 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.
-
-