Package org.ametys.cms.search.solr
Class CriteriaSearchUIModelWrapper
java.lang.Object
org.ametys.cms.search.ui.model.AbstractSearchUIModel
org.ametys.cms.search.solr.CriteriaSearchUIModelWrapper
- All Implemented Interfaces:
SearchModel
,SearchUIModel
,LogEnabled
,Contextualizable
,Serviceable
Search model wrapper which handles custom on-the-fly columns and facets.
-
Field Summary
Modifier and TypeFieldDescriptionprotected ThreadSafeComponentManager<SearchUIColumn>
ComponentManager forSearchUIColumn
s.protected ThreadSafeComponentManager<SearchUICriterion>
ComponentManager forSearchUICriterion
s.Fields inherited from class org.ametys.cms.search.ui.model.AbstractSearchUIModel
_advancedSearchCriteria, _columns, _context, _cTypeEP, _cTypes, _excludedCTypes, _facetedCriteria, _logger, _manager, _searchCriteria, _searchModelHelper
-
Constructor Summary
ConstructorDescriptionCriteriaSearchUIModelWrapper
(SearchUIModel model, ServiceManager manager, Context context, Logger logger) Build a model wrapper. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addIndexingFieldCriteriaComponents
(List<Object> searchToolCriterionRoles, Set<String> baseContentTypeIds, String fieldRef) Add a indexing field criteria component to the manager.protected void
addMetadataColumnComponents
(List<Object> columnsRolesToLookup, Set<String> baseContentTypeIds, String metadataPath, Optional<String> columnLabel) Add a metadata column component to the manager.protected void
addSystemColumnComponent
(List<Object> columnsRolesToLookup, Set<String> baseContentTypeIds, String property, Optional<String> columnLabel) Add a system column component to the manager.protected void
addSystemCriteriaComponents
(List<Object> searchToolCriterionRoles, Set<String> baseContentTypeIds, String property) Add a system criteria component to the manager.boolean
protected void
configureColumns
(List<Object> columnRoles, Set<String> baseContentTypeIds, Collection<ColumnHelper.Column> columnIds, SearchUIModel referenceModel, Map<String, Object> contextualParameters) Configure the list of search columns.protected Collection<String>
configureFacets
(List<Object> criteriaRoles, Set<String> baseContentTypeIds, Collection<String> criteriaIds, SearchUIModel referenceModel, Map<String, Object> contextualParameters) Configure the list of faceted criteria.getAdvancedCriteria
(Map<String, Object> contextualParameters) Get the list of search criteria in advanced modeprotected SearchUIColumn
Search a column in the reference model from its column identifier.getContentTypes
(Map<String, Object> contextualParameters) Get the list of content types.getCriteria
(Map<String, Object> contextualParameters) Get the list of search criteria in simple modegetCriterion
(String id, Map<String, Object> contextualParameters) Get a simple search criterion by its idprotected SearchUICriterion
getCriterion
(SearchUIModel searchModel, String criterionId, Map<String, Object> contextualParameters) Search a criterion in the reference model from its criterion identifier.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 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 resultsgetFacetedCriteria
(Map<String, Object> contextualParameters) Get the list of faceted search criteria.getPrintUrl
(Map<String, Object> contextualParameters) Get the URL for print resultsgetPrintUrlPlugin
(Map<String, Object> contextualParameters) Get the plugin name for print resultsgetResultField
(String id, Map<String, Object> contextualParameters) Get the column by its identifiergetResultFields
(Map<String, Object> contextualParameters) Get the column for resultsgetSearchUrl
(Map<String, Object> contextualParameters) Get the URL for searchgetSearchUrlPlugin
(Map<String, Object> contextualParameters) Get the plugin name for searchvoid
service
(ServiceManager manager) setFacetedCriteria
(Set<String> baseContentTypeIds, Collection<String> criteriaIds, Map<String, Object> contextualParameters) Set the custom faceted criteria.void
setResultColumns
(Set<String> baseContentTypeIds, Collection<ColumnHelper.Column> columns, Map<String, Object> contextualParameters) Set the custom columns.Methods inherited from class org.ametys.cms.search.ui.model.AbstractSearchUIModel
addContentTypesConfiguration, contextualize, getCustomCriteriaConfiguration, getIndexingFieldCriteriaConfiguration, getIndexingFieldCriteriaConfiguration, getIndexingFieldCriteriaConfiguration, getLogger, getMetadataColumnConfiguration, getMetadataColumnConfiguration, getPageSize, 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
getAdvancedCriterion, getFacetedCriterion
-
Field Details
-
_searchUICriterionManager
ComponentManager forSearchUICriterion
s. -
_searchUIColumnManager
ComponentManager forSearchUIColumn
s.
-
-
Constructor Details
-
CriteriaSearchUIModelWrapper
public CriteriaSearchUIModelWrapper(SearchUIModel model, ServiceManager manager, Context context, Logger logger) Build a model wrapper.- Parameters:
model
- the search model to wrap.manager
- the service manager.context
- the component context.logger
- the logger.
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSearchUIModel
- Throws:
ServiceException
-
setFacetedCriteria
public Collection<String> setFacetedCriteria(Set<String> baseContentTypeIds, Collection<String> criteriaIds, Map<String, Object> contextualParameters) throws ExceptionSet the custom faceted criteria.- Parameters:
baseContentTypeIds
- the reference content type identifiers.criteriaIds
- the criteria IDscontextualParameters
- the contextual parameters- Returns:
- the valid criteria IDs
- Throws:
Exception
- if an error occurs initializing criteria.
-
setResultColumns
public void setResultColumns(Set<String> baseContentTypeIds, Collection<ColumnHelper.Column> columns, Map<String, Object> contextualParameters) throws ExceptionSet the custom columns.- Parameters:
baseContentTypeIds
- the reference content type identifiers.columns
- The columnscontextualParameters
- the contextual parameters- Throws:
Exception
- if an error occurs initializing columns.
-
configureFacets
protected Collection<String> configureFacets(List<Object> criteriaRoles, Set<String> baseContentTypeIds, Collection<String> criteriaIds, SearchUIModel referenceModel, Map<String, Object> contextualParameters) throws ConfigurationExceptionConfigure the list of faceted criteria.- Parameters:
criteriaRoles
- the roles of criteria to lookup (or the already existing SearchUICriterion objects).baseContentTypeIds
- The reference content type identifiers.criteriaIds
- the criteria IDs.referenceModel
- the reference model.contextualParameters
- the contextual parameters- Returns:
- the valid criteria IDs
- Throws:
ConfigurationException
- if an error occurs creating a component configuration.
-
getCriterion
protected SearchUICriterion getCriterion(SearchUIModel searchModel, String criterionId, Map<String, Object> contextualParameters) Search a criterion in the reference model from its criterion identifier.- Parameters:
searchModel
- the reference search model.criterionId
- the criterion identifier.contextualParameters
- the contextual parameters- Returns:
- the criterion if found, null otherwise.
-
configureColumns
protected void configureColumns(List<Object> columnRoles, Set<String> baseContentTypeIds, Collection<ColumnHelper.Column> columnIds, SearchUIModel referenceModel, Map<String, Object> contextualParameters) throws ConfigurationExceptionConfigure the list of search columns.- Parameters:
columnRoles
- the roles of columns to lookup (or the already existing SearchUIColumn objects).baseContentTypeIds
- The reference content type identifiers.columnIds
- The columnsreferenceModel
- the reference model.contextualParameters
- the contextual parameters- Throws:
ConfigurationException
- if an error occurs creating a component configuration.
-
getColumn
protected SearchUIColumn getColumn(SearchUIModel searchModel, String columnId, Map<String, Object> contextualParameters) Search a column in the reference model from its column identifier.- Parameters:
searchModel
- the reference search model.columnId
- the column identifier.contextualParameters
- the contextual parameters- Returns:
- the column if found, null otherwise.
-
addIndexingFieldCriteriaComponents
protected void addIndexingFieldCriteriaComponents(List<Object> searchToolCriterionRoles, Set<String> baseContentTypeIds, String fieldRef) throws ConfigurationException Add a indexing field criteria component to the manager.- Parameters:
searchToolCriterionRoles
- the criteria role list to fill.baseContentTypeIds
- the reference content type identifiers.fieldRef
- the field path.- Throws:
ConfigurationException
- if an error occurs.
-
addSystemCriteriaComponents
protected void addSystemCriteriaComponents(List<Object> searchToolCriterionRoles, Set<String> baseContentTypeIds, String property) throws ConfigurationException Add a system criteria component to the manager.- Parameters:
searchToolCriterionRoles
- the criteria role list to fill.baseContentTypeIds
- the reference content type identifiers.property
- the system property id.- Throws:
ConfigurationException
- if an error occurs.
-
addMetadataColumnComponents
protected void addMetadataColumnComponents(List<Object> columnsRolesToLookup, Set<String> baseContentTypeIds, String metadataPath, Optional<String> columnLabel) throws ConfigurationException Add a metadata column component to the manager.- Parameters:
columnsRolesToLookup
- the columns rolesbaseContentTypeIds
- the reference content type identifiers.metadataPath
- the metadata path.columnLabel
- The (optional) label of the column. If not present, the column label will be the metadata one.- Throws:
ConfigurationException
- if an error occurs.
-
addSystemColumnComponent
protected void addSystemColumnComponent(List<Object> columnsRolesToLookup, Set<String> baseContentTypeIds, String property, Optional<String> columnLabel) throws ConfigurationException Add a system column component to the manager.- Parameters:
columnsRolesToLookup
- the columns rolesbaseContentTypeIds
- the reference content type identifiers.property
- the system property.columnLabel
- The (optional) label of the column. If not present, the column label will be the metadata one.- Throws:
ConfigurationException
- if an error occurs.
-
getFacetedCriteria
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.
-
getResultFields
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
-
getResultField
Description copied from interface:SearchModel
Get the column by its identifier- Parameters:
id
- The column idcontextualParameters
- the contextual parameters- Returns:
- the column
-
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.
-
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
-
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
-
allowSortOnMultipleJoin
Description copied from interface:SearchUIModel
Indicates if sorting on join columns which contain at least onemultiple
metadata
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.- Returns:
- true if sorting on join columns which contains at least one multiple metadata in its path (intermediate ones only) must be allowed.
-
getCriteria
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
-
getCriterion
Description copied from interface:SearchModel
Get a simple search criterion by its id- Parameters:
id
- The search criterion idcontextualParameters
- the contextual parameters- Returns:
- the criterion or
null
if not found
-
getAdvancedCriteria
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
-