Package org.ametys.cms.search.ui.model
Class StaticSearchUIModel
java.lang.Object
org.ametys.cms.search.ui.model.AbstractSearchUIModel
org.ametys.cms.search.ui.model.StaticSearchUIModel
- All Implemented Interfaces:
SearchModel
,SearchUIModel
,LogEnabled
,Disposable
,Configurable
,Contextualizable
,Serviceable
public class StaticSearchUIModel
extends AbstractSearchUIModel
implements Serviceable, Contextualizable, Configurable, Disposable
Static implementation of a
AbstractSearchUIModel
-
Field Summary
Modifier and TypeFieldDescriptionprotected ColumnHelper
The helper for columnsprotected ContentTypeExtensionPoint
The content type extension pointprotected ContentTypesHelper
The content type helper.protected Context
The context.protected ServiceManager
The service managerprotected SearchCriterionHelper
The search criterion helperprotected ThreadSafeComponentManager<SearchUICriterion>
ComponentManager forSearchUICriterion
s.protected SystemPropertyExtensionPoint
The system property extension point.Fields inherited from class org.ametys.cms.search.ui.model.AbstractSearchUIModel
_advancedSearchCriteria, _cTypes, _excludedCTypes, _facetedCriteria, _logger, _resultItems, _searchCriteria, DEFAULT_EXPORT_CSV_URL, DEFAULT_EXPORT_DOC_URL, DEFAULT_EXPORT_PDF_URL, DEFAULT_EXPORT_XML_URL, DEFAULT_PRINT_URL, DEFAULT_SEARCH_URL, DEFAULT_URL_PLUGIN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_addCriteriaComponents
(Set<ContentType> commonContentTypes, Configuration configuration, List<String> searchCriteriaRoles) Add criteria components to the search criteria manager.protected void
_addCriteriaComponents
(Set<ContentType> commonContentTypes, Configuration configuration, List<String> searchCriteriaRoles, I18nizableText group) Add standard criteria components to the search criteria manager.protected void
_addCustomCriteriaComponents
(Set<ContentType> commonContentTypes, Configuration conf, List<String> searchCriteriaRoles, String searchCriterionId, I18nizableText group) Add a custom criteria component to the manager.protected void
_addFacetCriteriaComponents
(Set<ContentType> commonContentTypes, Configuration configuration, List<String> searchCriteriaRoles) Add facet criteria components to the search criteria manager.protected void
_addIndexingFieldCriteriaComponents
(Set<ContentType> commonContentTypes, Configuration conf, List<String> searchCriteriaRoles, String fieldRef, I18nizableText group) Add a indexing field criteria component to the manager.protected void
_addSystemCriteriaComponents
(Set<ContentType> commonContentTypes, Configuration originalConf, List<String> searchCriteriaRoles, String property, I18nizableText group) Add a system criteria component to the manager._configureBaseContentTypes
(Configuration configuration) Configure the base content type ids.protected void
_configureContentTypes
(Configuration configuration) Configure the content type idsprotected void
_configureCriteria
(Map<String, SearchUICriterion> criteriaMap, List<String> criteriaRoles, boolean checkFacetable) Lookup the previously initialized criteria components and fill the given map with them.protected void
_copyAdvancedCriteria
(Map<String, SearchUICriterion> advancedCriteria, Collection<SearchUICriterion> criteria) Copy all the allowed search criteria to the given criteria map.protected void
_copyFacetableCriteria
(Map<String, SearchUICriterion> facetedCriteria, Collection<SearchUICriterion> criteria) Copy all the facetable search criteria to the given criteria map.protected boolean
_isAdvanced
(SearchUICriterion criterion) Test if a search criterion can be used in advanced search mode.protected boolean
Determines if the content type is a valid content type in current configurationboolean
Indicates if sorting on join columns which contain at least onemultiple
definition
in its path (intermediate ones only) must be allowed.void
configure
(Configuration configuration) void
contextualize
(Context context) void
dispose()
getContentTypes
(Map<String, Object> contextualParameters) Get the list of content types.getExcludedContentTypes
(Map<String, Object> contextualParameters) Get the list of excluded content types.getExportCSVUrl
(Map<String, Object> contextualParameters) Get the URL for CSV export of resultsgetExportCSVUrlPlugin
(Map<String, Object> contextualParameters) Get the plugin name for CSV export of resultsgetExportDOCUrl
(Map<String, Object> contextualParameters) Get the URL for DOC export of resultsgetExportDOCUrlPlugin
(Map<String, Object> contextualParameters) Get the plugin name for DOC export of resultsgetExportPDFUrl
(Map<String, Object> contextualParameters) Get the URL for PDF export of resultsgetExportPDFUrlPlugin
(Map<String, Object> contextualParameters) Get the plugin name for PDF export of resultsgetExportXMLUrl
(Map<String, Object> contextualParameters) Get the URL for XML export of resultsgetExportXMLUrlPlugin
(Map<String, Object> contextualParameters) Get the plugin name for XML export of resultsint
getPageSize
(Map<String, Object> contextualParameters) Get the page size.getPrintUrl
(Map<String, Object> contextualParameters) Get the URL for print resultsgetPrintUrlPlugin
(Map<String, Object> contextualParameters) Get the plugin name for print resultsgetSearchUrl
(Map<String, Object> contextualParameters) Get the URL for searchgetSearchUrlPlugin
(Map<String, Object> contextualParameters) Get the plugin name for searchGet the name of the view to use for summary of the content.getWorkspace
(Map<String, Object> contextualParameters) Get the specific workspace to use.void
service
(ServiceManager manager) Methods inherited from class org.ametys.cms.search.ui.model.AbstractSearchUIModel
getAdvancedCriteria, getCriteria, getFacetedCriteria, getLogger, getResultItems, setAdvancedCriteria, setContentTypes, setCriteria, setExcludedContentTypes, setFacetedCriteria, setLogger, setResultItems
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.model.SearchModel
getResultItem
Methods inherited from interface org.ametys.cms.search.ui.model.SearchUIModel
getAdvancedCriterion, getCriterion, getFacetedCriterion
-
Field Details
-
_searchCriterionManager
ComponentManager forSearchUICriterion
s. -
_context
The context. -
_manager
The service manager -
_contentTypesHelper
The content type helper. -
_columnHelper
The helper for columns -
_contentTypeExtensionPoint
The content type extension point -
_systemPropertyExtensionPoint
The system property extension point. -
_searchCriterionHelper
The search criterion helper
-
-
Constructor Details
-
StaticSearchUIModel
public StaticSearchUIModel()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
dispose
- Specified by:
dispose
in interfaceDisposable
-
getContentTypes
Description copied from interface:SearchModel
Get the list of content types.- Specified by:
getContentTypes
in interfaceSearchModel
- Overrides:
getContentTypes
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters.- Returns:
- The list of content types.
-
getExcludedContentTypes
Description copied from interface:SearchModel
Get the list of excluded content types.- Specified by:
getExcludedContentTypes
in interfaceSearchModel
- Overrides:
getExcludedContentTypes
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- The list of excluded content types.
-
getPageSize
Description copied from interface:SearchUIModel
Get the page size.- Specified by:
getPageSize
in interfaceSearchUIModel
- Overrides:
getPageSize
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters.- Returns:
- The page size, unlimited or default used when negative or 0.
-
getWorkspace
Description copied from interface:SearchModel
Get the specific workspace to use.- Specified by:
getWorkspace
in interfaceSearchModel
- Overrides:
getWorkspace
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters.- Returns:
- the workspace to use when searching, or null to use the default workspace.
-
getSearchUrl
Description copied from interface:SearchUIModel
Get the URL for search- Specified by:
getSearchUrl
in interfaceSearchUIModel
- Overrides:
getSearchUrl
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the URL for search
-
getSearchUrlPlugin
Description copied from interface:SearchUIModel
Get the plugin name for search- Specified by:
getSearchUrlPlugin
in interfaceSearchUIModel
- Overrides:
getSearchUrlPlugin
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the plugin name for search
-
getExportCSVUrl
Description copied from interface:SearchUIModel
Get the URL for CSV export of results- Specified by:
getExportCSVUrl
in interfaceSearchUIModel
- Overrides:
getExportCSVUrl
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the URL for CSV export
-
getExportCSVUrlPlugin
Description copied from interface:SearchUIModel
Get the plugin name for CSV export of results- Specified by:
getExportCSVUrlPlugin
in interfaceSearchUIModel
- Overrides:
getExportCSVUrlPlugin
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the plugin name for CSV export
-
getExportDOCUrl
Description copied from interface:SearchUIModel
Get the URL for DOC export of results- Specified by:
getExportDOCUrl
in interfaceSearchUIModel
- Overrides:
getExportDOCUrl
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the URL for DOC export
-
getExportDOCUrlPlugin
Description copied from interface:SearchUIModel
Get the plugin name for DOC export of results- Specified by:
getExportDOCUrlPlugin
in interfaceSearchUIModel
- Overrides:
getExportDOCUrlPlugin
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the plugin name for DOC export
-
getExportXMLUrl
Description copied from interface:SearchUIModel
Get the URL for XML export of results- Specified by:
getExportXMLUrl
in interfaceSearchUIModel
- Overrides:
getExportXMLUrl
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the URL for XML export
-
getExportXMLUrlPlugin
Description copied from interface:SearchUIModel
Get the plugin name for XML export of results- Specified by:
getExportXMLUrlPlugin
in interfaceSearchUIModel
- Overrides:
getExportXMLUrlPlugin
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the plugin name for XML export
-
getExportPDFUrl
Description copied from interface:SearchUIModel
Get the URL for PDF export of results- Specified by:
getExportPDFUrl
in interfaceSearchUIModel
- Overrides:
getExportPDFUrl
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the URL for PDF export
-
getExportPDFUrlPlugin
Description copied from interface:SearchUIModel
Get the plugin name for PDF export of results- Specified by:
getExportPDFUrlPlugin
in interfaceSearchUIModel
- Overrides:
getExportPDFUrlPlugin
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the plugin name for PDF export
-
getPrintUrl
Description copied from interface:SearchUIModel
Get the URL for print results- Specified by:
getPrintUrl
in interfaceSearchUIModel
- Overrides:
getPrintUrl
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the URL for print results
-
getPrintUrlPlugin
Description copied from interface:SearchUIModel
Get the plugin name for print results- Specified by:
getPrintUrlPlugin
in interfaceSearchUIModel
- Overrides:
getPrintUrlPlugin
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the plugin name for print results
-
getSummaryView
Description copied from interface:SearchUIModel
Get the name of the view to use for summary of the content.- Specified by:
getSummaryView
in interfaceSearchUIModel
- Overrides:
getSummaryView
in classAbstractSearchUIModel
- Returns:
- the name of the view to use for summary of the content. Can be null.
-
allowSortOnMultipleJoin
Description copied from interface:SearchUIModel
Indicates if sorting on join columns which contain at least onemultiple
definition
in its path (intermediate ones only) must be allowed.
If the final metadata of the path is multiple, the column will not be sortable though.- Specified by:
allowSortOnMultipleJoin
in interfaceSearchUIModel
- Returns:
- true if sorting on join columns which contains at least one multiple metadata in its path (intermediate ones only) must be allowed.
-
_configureContentTypes
Configure the content type ids- Parameters:
configuration
- The content types configuration- Throws:
ConfigurationException
- If an error occurs
-
_configureBaseContentTypes
protected Set<String> _configureBaseContentTypes(Configuration configuration) throws ConfigurationException Configure the base content type ids.- Parameters:
configuration
- The content types configuration- Returns:
- The set of base content type ids
- Throws:
ConfigurationException
- If an error occurs
-
_isValidContentType
protected boolean _isValidContentType(String id, List<String> excludedTags, List<String> excludedContentTypes) Determines if the content type is a valid content type in current configuration- Parameters:
id
- The content type idexcludedTags
- The tags to excludeexcludedContentTypes
- The content types to exclude- Returns:
true
if the content type is a valid content type
-
_addCriteriaComponents
protected void _addCriteriaComponents(Set<ContentType> commonContentTypes, Configuration configuration, List<String> searchCriteriaRoles) throws ConfigurationException Add criteria components to the search criteria manager.- Parameters:
commonContentTypes
- the model's common content types.configuration
- the model configuration.searchCriteriaRoles
- the criteria role list to fill.- Throws:
ConfigurationException
- if an error occurs.
-
_addCriteriaComponents
protected void _addCriteriaComponents(Set<ContentType> commonContentTypes, Configuration configuration, List<String> searchCriteriaRoles, I18nizableText group) throws ConfigurationException Add standard criteria components to the search criteria manager.- Parameters:
commonContentTypes
- the model's common content types.configuration
- the model configuration.searchCriteriaRoles
- the criteria role list to fill.group
- the criteria group.- Throws:
ConfigurationException
- if an error occurs.
-
_addFacetCriteriaComponents
protected void _addFacetCriteriaComponents(Set<ContentType> commonContentTypes, Configuration configuration, List<String> searchCriteriaRoles) throws ConfigurationException Add facet criteria components to the search criteria manager.- Parameters:
commonContentTypes
- the model's common content types.configuration
- the model configuration.searchCriteriaRoles
- the criteria role list to fill.- Throws:
ConfigurationException
- if an error occurs.
-
_addIndexingFieldCriteriaComponents
protected void _addIndexingFieldCriteriaComponents(Set<ContentType> commonContentTypes, Configuration conf, List<String> searchCriteriaRoles, String fieldRef, I18nizableText group) throws ConfigurationException Add a indexing field criteria component to the manager.- Parameters:
commonContentTypes
- the model common content types.conf
- the criteria configuration.searchCriteriaRoles
- the criteria role list to fill.fieldRef
- the field path.group
- The group.- Throws:
ConfigurationException
- if an error occurs.
-
_addSystemCriteriaComponents
protected void _addSystemCriteriaComponents(Set<ContentType> commonContentTypes, Configuration originalConf, List<String> searchCriteriaRoles, String property, I18nizableText group) throws ConfigurationException Add a system criteria component to the manager.- Parameters:
commonContentTypes
- the model common content types.originalConf
- the criteria configuration.searchCriteriaRoles
- the criteria role list to fill.property
- the system property id.group
- The group.- Throws:
ConfigurationException
- if an error occurs.
-
_addCustomCriteriaComponents
protected void _addCustomCriteriaComponents(Set<ContentType> commonContentTypes, Configuration conf, List<String> searchCriteriaRoles, String searchCriterionId, I18nizableText group) throws ConfigurationException Add a custom criteria component to the manager.- Parameters:
commonContentTypes
- the model common content types.conf
- the criteria configuration.searchCriteriaRoles
- the criteria role list to fill.searchCriterionId
- the custom criteria id.group
- The group. Can be null.- Throws:
ConfigurationException
- if an error occurs.
-
_configureCriteria
protected void _configureCriteria(Map<String, SearchUICriterion> criteriaMap, List<String> criteriaRoles, boolean checkFacetable) throws ConfigurationExceptionLookup the previously initialized criteria components and fill the given map with them.- Parameters:
criteriaMap
- the criteria map to fill.criteriaRoles
- the roles of the criteria components to lookup.checkFacetable
- true to check if the criteria are facetable.- Throws:
ConfigurationException
- if an error occurs.
-
_copyAdvancedCriteria
protected void _copyAdvancedCriteria(Map<String, SearchUICriterion> advancedCriteria, Collection<SearchUICriterion> criteria) throws ConfigurationExceptionCopy all the allowed search criteria to the given criteria map.- Parameters:
advancedCriteria
- the criteria map to fill.criteria
- the source criteria collection.- Throws:
ConfigurationException
- if an error occurs.
-
_copyFacetableCriteria
protected void _copyFacetableCriteria(Map<String, SearchUICriterion> facetedCriteria, Collection<SearchUICriterion> criteria) throws ConfigurationExceptionCopy all the facetable search criteria to the given criteria map.- Parameters:
facetedCriteria
- the criteria map to fill.criteria
- the source criteria collection.- Throws:
ConfigurationException
- if an error occurs.
-
_isAdvanced
Test if a search criterion can be used in advanced search mode. For instance: geocode, rich-text, file-typed criterion are not allowed.- Parameters:
criterion
- the search criterion to test.- Returns:
true
if the criterion can be used in advanced search mode,false
otherwise.
-