Package org.ametys.cms.search.ui.model
Class ReferenceTableSearchUIModel
- java.lang.Object
-
- org.ametys.cms.search.ui.model.AbstractSearchUIModel
-
- org.ametys.cms.search.ui.model.ReferenceTableSearchUIModel
-
- All Implemented Interfaces:
SearchModel
,SearchUIModel
,LogEnabled
,Configurable
,Contextualizable
,Serviceable
public class ReferenceTableSearchUIModel extends AbstractSearchUIModel implements Configurable
Generic implementation ofSearchUIModel
for reference tables The search tool model automatically declares simple first level metadatas as criteria and columns.
-
-
Field Summary
Fields Modifier and Type Field Description protected HierarchicalReferenceTablesHelper
_hierarchicalReferenceTableContentsHelper
The helper component for hierarchical reference tablesprotected ThreadSafeComponentManager<SearchUIColumn>
_searchColumnManager
ComponentManager forSearchUIColumn
s.protected List<String>
_searchColumnRoles
The search column roles.protected ThreadSafeComponentManager<SearchUICriterion>
_searchCriteriaManager
ComponentManager forSearchUICriterion
s.protected List<String>
_searchCriteriaRoles
The search criteria roles.-
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 ReferenceTableSearchUIModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
_filterModelItemForColumn(ModelItem modelItem)
Returnstrue
if model item can be used as column search UIprotected boolean
_filterModelItemForCriteria(ModelItem modelItem)
Returnstrue
if the model item can be used as criteriaprotected void
addAttributeColumnComponent(ContentType contentType, String attributeName)
Add an attribute column component to the manager.protected void
addAttributeCriterionComponent(ContentType contentType, String attributeName, Query.Operator operator)
Add an attribute criterion component to the manager.protected void
addColumnComponents(ContentType cType)
Add column components to the manager.protected void
addCriteriaComponents(ContentType cType)
Add criteria components to the manager.protected void
addExcludeCandidateSystemCriterionComponent(ContentType cType)
Add criteria component to exclude the candidatesprotected void
addLikeTitleCriterionComponent(ContentType contentType)
Add the title attribute criterion component to the manager, with a 'LIKE' operator and an hidden widgetprotected void
addSystemColumnComponent(ContentType contentType, String property)
Add a system column component to the manager.protected void
addSystemCriterionComponent(ContentType contentType, String property)
Add a system criterion component to the manager.void
configure(Configuration configuration)
Map<String,SearchUICriterion>
getAdvancedCriteria(Map<String,Object> contextualParameters)
Get the list of search criteria in advanced modeprotected List<SearchUIColumn>
getColumns(ContentType cType)
Lookup all the columns.Map<String,SearchUICriterion>
getCriteria(Map<String,Object> contextualParameters)
Get the list of search criteria in simple modeSet<String>
getExcludedContentTypes(Map<String,Object> contextualParameters)
Get the list of excluded content types.Map<String,SearchUICriterion>
getFacetedCriteria(Map<String,Object> contextualParameters)
Get the list of faceted search criteria.Map<String,SearchUIColumn>
getResultFields(Map<String,Object> contextualParameters)
Get the column for resultsprotected List<SearchUICriterion>
getSearchUICriteria(ContentType cType)
Lookup all the criteria.void
service(ServiceManager smanager)
-
Methods inherited from class org.ametys.cms.search.ui.model.AbstractSearchUIModel
addContentTypesConfiguration, contextualize, getContentTypes, getCustomCriteriaConfiguration, getExportCSVUrl, getExportCSVUrlPlugin, getExportDOCUrl, getExportDOCUrlPlugin, getExportXMLUrl, getExportXMLUrlPlugin, getIndexingFieldCriteriaConfiguration, getIndexingFieldCriteriaConfiguration, getIndexingFieldCriteriaConfiguration, getLogger, getMetadataColumnConfiguration, getMetadataColumnConfiguration, getPageSize, getPrintUrl, getPrintUrlPlugin, getSearchUrl, getSearchUrlPlugin, getSummaryView, getSystemColumnConfiguration, getSystemColumnConfiguration, getSystemCriteriaConfiguration, getSystemCriteriaConfiguration, getSystemCriteriaConfiguration, getWorkspace, 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
allowSortOnMultipleJoin, getAdvancedCriterion, getCriterion, getFacetedCriterion, getResultField
-
-
-
-
Field Detail
-
_searchCriteriaManager
protected ThreadSafeComponentManager<SearchUICriterion> _searchCriteriaManager
ComponentManager forSearchUICriterion
s.
-
_searchColumnManager
protected ThreadSafeComponentManager<SearchUIColumn> _searchColumnManager
ComponentManager forSearchUIColumn
s.
-
_searchCriteriaRoles
protected List<String> _searchCriteriaRoles
The search criteria roles.
-
_searchColumnRoles
protected List<String> _searchColumnRoles
The search column roles.
-
_hierarchicalReferenceTableContentsHelper
protected HierarchicalReferenceTablesHelper _hierarchicalReferenceTableContentsHelper
The helper component for hierarchical reference tables
-
-
Constructor Detail
-
ReferenceTableSearchUIModel
public ReferenceTableSearchUIModel()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSearchUIModel
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
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
- Overrides:
getExcludedContentTypes
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- The list of 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
- Overrides:
getCriteria
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the list of search criteria in simple mode
-
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
- Overrides:
getFacetedCriteria
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the list of faceted 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
- Overrides:
getAdvancedCriteria
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the list of search criteria in advanced mode
-
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
- Overrides:
getResultFields
in classAbstractSearchUIModel
- Parameters:
contextualParameters
- the contextual parameters. Can be null.- Returns:
- the column for results
-
addCriteriaComponents
protected void addCriteriaComponents(ContentType cType) throws ConfigurationException, ComponentException
Add criteria components to the manager.- Parameters:
cType
- the simple content type.- Throws:
ConfigurationException
- if a configuration error occurs.ComponentException
- if a component cannot be initialized.
-
addExcludeCandidateSystemCriterionComponent
protected void addExcludeCandidateSystemCriterionComponent(ContentType cType)
Add criteria component to exclude the candidates- Parameters:
cType
- the simple content type
-
_filterModelItemForCriteria
protected boolean _filterModelItemForCriteria(ModelItem modelItem)
Returnstrue
if the model item can be used as criteria- Parameters:
modelItem
- the model item- Returns:
true
if the model item can be used as criteria
-
_filterModelItemForColumn
protected boolean _filterModelItemForColumn(ModelItem modelItem)
Returnstrue
if model item can be used as column search UI- Parameters:
modelItem
- the model item- Returns:
true
if model item can be used as column search UI
-
addLikeTitleCriterionComponent
protected void addLikeTitleCriterionComponent(ContentType contentType) throws ConfigurationException, ComponentException
Add the title attribute criterion component to the manager, with a 'LIKE' operator and an hidden widget- Parameters:
contentType
- the simple content type.- Throws:
ConfigurationException
- if a configuration error occurs.ComponentException
- if a component cannot be initialized.
-
addAttributeCriterionComponent
protected void addAttributeCriterionComponent(ContentType contentType, String attributeName, Query.Operator operator) throws ConfigurationException, ComponentException
Add an attribute criterion component to the manager.- Parameters:
contentType
- the simple content type.attributeName
- the attribute name.operator
- the criterion operator.- Throws:
ConfigurationException
- if a configuration error occurs.ComponentException
- if a component cannot be initialized.
-
addSystemCriterionComponent
protected void addSystemCriterionComponent(ContentType contentType, String property) throws ConfigurationException, ComponentException
Add a system criterion component to the manager.- Parameters:
contentType
- the simple content type.property
- the system property.- Throws:
ConfigurationException
- if a configuration error occurs.ComponentException
- if a component cannot be initialized.
-
getSearchUICriteria
protected List<SearchUICriterion> getSearchUICriteria(ContentType cType) throws ComponentException
Lookup all the criteria.- Parameters:
cType
- the simple content type.- Returns:
- the search criteria list.
- Throws:
ComponentException
- if a component cannot be looked up.
-
addColumnComponents
protected void addColumnComponents(ContentType cType) throws ConfigurationException, ComponentException
Add column components to the manager.- Parameters:
cType
- the simple content type.- Throws:
ConfigurationException
- if a configuration error occurs.ComponentException
- if a component cannot be initialized.
-
addAttributeColumnComponent
protected void addAttributeColumnComponent(ContentType contentType, String attributeName) throws ConfigurationException, ComponentException
Add an attribute column component to the manager.- Parameters:
contentType
- the simple content type.attributeName
- the attribute name.- Throws:
ConfigurationException
- if a configuration error occurs.ComponentException
- if a component cannot be initialized.
-
addSystemColumnComponent
protected void addSystemColumnComponent(ContentType contentType, String property) throws ConfigurationException, ComponentException
Add a system column component to the manager.- Parameters:
contentType
- the simple content type.property
- the system property.- Throws:
ConfigurationException
- if a configuration error occurs.ComponentException
- if a component cannot be initialized.
-
getColumns
protected List<SearchUIColumn> getColumns(ContentType cType) throws ComponentException
Lookup all the columns.- Parameters:
cType
- the simple content type.- Returns:
- the search column list.
- Throws:
ComponentException
- if a component cannot be looked up.
-
-