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 Configurable, Disposable
Static implementation of aAbstractSearchUIModel
-
-
Field Summary
Fields Modifier and Type Field Description protected ColumnHelper_columnHelperThe helper for columnsprivate int_criteriaIndexprotected ContentTypesHelper_cTypeHelperThe content type helper.private String_exportCSVUrlprivate String_exportCSVUrlPluginprivate String_exportDOCUrlprivate String_exportDOCUrlPluginprivate String_exportXMLUrlprivate String_exportXMLUrlPluginprivate int_pageSizeprivate String_printUrlprivate String_printUrlPluginprotected ThreadSafeComponentManager<SearchUIColumn>_searchColumnManagerComponentManager forSearchUIColumns.protected ThreadSafeComponentManager<SearchUICriterion>_searchCriterionManagerComponentManager forSearchUICriterions.private String_searchUrlprivate String_searchUrlPluginprivate boolean_sortOnMultipleJoinprivate String_summaryViewprotected SystemPropertyExtensionPoint_systemPropEPThe system property extension point.private String_workspace-
Fields inherited from class org.ametys.cms.search.ui.model.AbstractSearchUIModel
_advancedSearchCriteria, _columns, _context, _cTypeEP, _cTypes, _excludedCTypes, _facetedCriteria, _logger, _manager, _searchCriteria, _searchModelHelper
-
-
Constructor Summary
Constructors Constructor Description StaticSearchUIModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_addColumnsComponents(Set<ContentType> commonContentTypes, Configuration configuration, List<String> columnsRolesToLookup)Add column components to the result column manager.protected 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_addCustomColumnComponent(Set<ContentType> commonContentTypes, Configuration conf, String customId, List<String> columnsRolesToLookup)Add a custom column component to the 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_addMetadataColumnComponents(Set<ContentType> commonContentTypes, Configuration conf, String metadataPath, List<String> columnsRolesToLookup)Add a metadata column component to the manager.protected void_addSystemColumnComponent(Set<ContentType> commonContentTypes, Configuration originalConf, String property, List<String> columnsRolesToLookup)Add a system column 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.protected Set<String>_configureBaseContentTypes(Configuration configuration)Configure the base content type ids.protected Map<String,SearchUIColumn>_configureColumns(List<String> columnRoles)Lookup all the configured columns in the manager.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.private void_configureExportCSVUrl(Configuration configuration)private void_configureExportDOCUrl(Configuration configuration)private void_configureExportXMLUrl(Configuration configuration)private I18nizableText_configureI18nizableText(Configuration config, I18nizableText defaultValue)private void_configurePrintUrl(Configuration configuration)private void_configureSearchUrl(Configuration configuration)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.private String_getSystemColumnRole(Set<String> cTypeIds, Configuration originalConf, String property)private List<String>_handleMetadataColumns(List<String> metadataColumnPaths, Set<String> contentTypeIds, Configuration conf)protected boolean_isAdvanced(SearchUICriterion criterion)Test if a search criterion can be used in advanced search mode.protected boolean_isValidContentType(String id, List<String> excludedTags, List<String> excludedContentTypes)Determines if the content type is a valid content type in current configurationbooleanallowSortOnMultipleJoin()voidconfigure(Configuration configuration)voiddispose()Set<String>getContentTypes(Map<String,Object> contextualParameters)Get the list of content types.Set<String>getExcludedContentTypes(Map<String,Object> contextualParameters)Get the list of excluded content types.StringgetExportCSVUrl(Map<String,Object> contextualParameters)Get the URL for CSV export of resultsStringgetExportCSVUrlPlugin(Map<String,Object> contextualParameters)Get the plugin name for CSV 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 resultsintgetPageSize(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 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.StringgetWorkspace(Map<String,Object> contextualParameters)Get the specific workspace to use.voidservice(ServiceManager manager)-
Methods inherited from class org.ametys.cms.search.ui.model.AbstractSearchUIModel
addContentTypesConfiguration, contextualize, getAdvancedCriteria, getCriteria, getCustomCriteriaConfiguration, getFacetedCriteria, getIndexingFieldCriteriaConfiguration, getIndexingFieldCriteriaConfiguration, getIndexingFieldCriteriaConfiguration, getLogger, getMetadataColumnConfiguration, getMetadataColumnConfiguration, getResultFields, getSystemColumnConfiguration, getSystemColumnConfiguration, getSystemCriteriaConfiguration, getSystemCriteriaConfiguration, getSystemCriteriaConfiguration, setAdvancedCriteria, setContentTypes, setCriteria, setExcludedContentTypes, setFacetedCriteria, setLogger, setResultFields
-
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
getAdvancedCriterion, getCriterion, getFacetedCriterion, getResultField
-
-
-
-
Field Detail
-
_cTypeHelper
protected ContentTypesHelper _cTypeHelper
The content type helper.
-
_columnHelper
protected ColumnHelper _columnHelper
The helper for columns
-
_searchCriterionManager
protected ThreadSafeComponentManager<SearchUICriterion> _searchCriterionManager
ComponentManager forSearchUICriterions.
-
_searchColumnManager
protected ThreadSafeComponentManager<SearchUIColumn> _searchColumnManager
ComponentManager forSearchUIColumns.
-
_systemPropEP
protected SystemPropertyExtensionPoint _systemPropEP
The system property extension point.
-
_criteriaIndex
private int _criteriaIndex
-
_pageSize
private int _pageSize
-
_workspace
private String _workspace
-
_searchUrl
private String _searchUrl
-
_searchUrlPlugin
private String _searchUrlPlugin
-
_exportCSVUrl
private String _exportCSVUrl
-
_exportCSVUrlPlugin
private String _exportCSVUrlPlugin
-
_exportDOCUrl
private String _exportDOCUrl
-
_exportDOCUrlPlugin
private String _exportDOCUrlPlugin
-
_exportXMLUrl
private String _exportXMLUrl
-
_exportXMLUrlPlugin
private String _exportXMLUrlPlugin
-
_printUrlPlugin
private String _printUrlPlugin
-
_summaryView
private String _summaryView
-
_sortOnMultipleJoin
private boolean _sortOnMultipleJoin
-
-
Constructor Detail
-
StaticSearchUIModel
public StaticSearchUIModel()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractSearchUIModel- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
dispose
public void dispose()
- Specified by:
disposein interfaceDisposable
-
getContentTypes
public Set<String> getContentTypes(Map<String,Object> contextualParameters)
Description copied from interface:SearchModelGet the list of content types.- Specified by:
getContentTypesin interfaceSearchModel- Overrides:
getContentTypesin classAbstractSearchUIModel- Parameters:
contextualParameters- the contextual parameters.- Returns:
- The list of 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- Overrides:
getExcludedContentTypesin classAbstractSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- The list of excluded content types.
-
getPageSize
public int getPageSize(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the page size.- Specified by:
getPageSizein interfaceSearchUIModel- Overrides:
getPageSizein classAbstractSearchUIModel- 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- Overrides:
getWorkspacein classAbstractSearchUIModel- 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- Overrides:
getSearchUrlin classAbstractSearchUIModel- 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- Overrides:
getSearchUrlPluginin classAbstractSearchUIModel- 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 CSV export of results- Specified by:
getExportCSVUrlin interfaceSearchUIModel- Overrides:
getExportCSVUrlin classAbstractSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the URL for CSV export
-
getExportCSVUrlPlugin
public String getExportCSVUrlPlugin(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the plugin name for CSV export of results- Specified by:
getExportCSVUrlPluginin interfaceSearchUIModel- Overrides:
getExportCSVUrlPluginin classAbstractSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the plugin name for CSV 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- Overrides:
getExportDOCUrlin classAbstractSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the URL for DOC 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- Overrides:
getExportDOCUrlPluginin classAbstractSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the plugin name for DOC 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- Overrides:
getExportXMLUrlin classAbstractSearchUIModel- 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- Overrides:
getExportXMLUrlPluginin classAbstractSearchUIModel- 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- Overrides:
getPrintUrlin classAbstractSearchUIModel- 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- Overrides:
getPrintUrlPluginin classAbstractSearchUIModel- 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- Overrides:
getSummaryViewin classAbstractSearchUIModel- Returns:
- the name of the view to use for summary of the content. Can be null.
-
allowSortOnMultipleJoin
public boolean allowSortOnMultipleJoin()
Description copied from interface:SearchUIModelIndicates if sorting on join columns which contain at least onemultiplemetadatain 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:
allowSortOnMultipleJoinin 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
protected void _configureContentTypes(Configuration configuration) throws ConfigurationException
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:
trueif the content type is a valid content type
-
_configureSearchUrl
private void _configureSearchUrl(Configuration configuration)
-
_configureExportCSVUrl
private void _configureExportCSVUrl(Configuration configuration)
-
_configureExportDOCUrl
private void _configureExportDOCUrl(Configuration configuration)
-
_configureExportXMLUrl
private void _configureExportXMLUrl(Configuration configuration)
-
_configurePrintUrl
private void _configurePrintUrl(Configuration configuration)
-
_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 ConfigurationException
Lookup 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 ConfigurationException
Copy 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 ConfigurationException
Copy 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
protected boolean _isAdvanced(SearchUICriterion criterion)
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:
trueif the criterion can be used in advanced search mode,falseotherwise.
-
_addColumnsComponents
protected void _addColumnsComponents(Set<ContentType> commonContentTypes, Configuration configuration, List<String> columnsRolesToLookup) throws ConfigurationException
Add column components to the result column manager.- Parameters:
commonContentTypes- the model's common content types.configuration- the model configuration.columnsRolesToLookup- The list of column roles to lookup that will be filled by the method.- Throws:
ConfigurationException- if an error occurs.
-
_addMetadataColumnComponents
protected void _addMetadataColumnComponents(Set<ContentType> commonContentTypes, Configuration conf, String metadataPath, List<String> columnsRolesToLookup) throws ConfigurationException
Add a metadata column component to the manager.- Parameters:
commonContentTypes- the model common content types.conf- the column configuration.metadataPath- the metadata path, separated by '/'.columnsRolesToLookup- The list to fill with the column roles to lookup when the manager is initialized.- Throws:
ConfigurationException- if an error occurs.
-
_handleMetadataColumns
private List<String> _handleMetadataColumns(List<String> metadataColumnPaths, Set<String> contentTypeIds, Configuration conf) throws ConfigurationException
- Throws:
ConfigurationException
-
_addSystemColumnComponent
protected void _addSystemColumnComponent(Set<ContentType> commonContentTypes, Configuration originalConf, String property, List<String> columnsRolesToLookup) throws ConfigurationException
Add a system column component to the manager.- Parameters:
commonContentTypes- the model common content types.originalConf- the column configuration.property- the system property.columnsRolesToLookup- The list to fill with the column roles to lookup when the manager is initialized.- Throws:
ConfigurationException- if an error occurs.
-
_getSystemColumnRole
private String _getSystemColumnRole(Set<String> cTypeIds, Configuration originalConf, String property) throws ConfigurationException
- Throws:
ConfigurationException
-
_addCustomColumnComponent
protected void _addCustomColumnComponent(Set<ContentType> commonContentTypes, Configuration conf, String customId, List<String> columnsRolesToLookup) throws ConfigurationException
Add a custom column component to the manager.- Parameters:
commonContentTypes- the model common content types.conf- the column configuration.customId- the custom column id.columnsRolesToLookup- The list to fill with the column roles to lookup when the manager is initialized.- Throws:
ConfigurationException- if an error occurs.
-
_configureColumns
protected Map<String,SearchUIColumn> _configureColumns(List<String> columnRoles) throws Exception
Lookup all the configured columns in the manager.- Parameters:
columnRoles- The list of column roles added to the component manager.- Returns:
- the list of search columns.
- Throws:
Exception- if an error occurs.
-
_configureI18nizableText
private I18nizableText _configureI18nizableText(Configuration config, I18nizableText defaultValue) throws ConfigurationException
- Throws:
ConfigurationException
-
-