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
public class CriteriaSearchUIModelWrapper extends AbstractSearchUIModel
Search model wrapper which handles custom on-the-fly columns and facets.
-
-
Field Summary
Fields Modifier and Type Field Description protected ThreadSafeComponentManager<SearchUIColumn>_searchUIColumnManagerComponentManager forSearchUIColumns.protected ThreadSafeComponentManager<SearchUICriterion>_searchUICriterionManagerComponentManager forSearchUICriterions.-
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 CriteriaSearchUIModelWrapper(SearchUIModel model, ServiceManager manager, Context context, org.slf4j.Logger logger)Build a model wrapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddIndexingFieldCriteriaComponents(List<Object> searchToolCriterionRoles, Set<String> baseContentTypeIds, String fieldRef)Add a indexing field criteria component to the manager.protected voidaddMetadataColumnComponents(List<Object> columnsRolesToLookup, Set<String> baseContentTypeIds, String metadataPath, Optional<String> columnLabel)Add a metadata column component to the manager.protected voidaddSystemColumnComponent(List<Object> columnsRolesToLookup, Set<String> baseContentTypeIds, String property, Optional<String> columnLabel)Add a system column component to the manager.protected voidaddSystemCriteriaComponents(List<Object> searchToolCriterionRoles, Set<String> baseContentTypeIds, String property)Add a system criteria component to the manager.booleanallowSortOnMultipleJoin()protected voidconfigureColumns(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.Map<String,SearchUICriterion>getAdvancedCriteria(Map<String,Object> contextualParameters)Get the list of search criteria in advanced modeprotected SearchUIColumngetColumn(SearchUIModel searchModel, String columnId, Map<String,Object> contextualParameters)Search a column in the reference model from its column identifier.Set<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 modeSearchUICriteriongetCriterion(String id, Map<String,Object> contextualParameters)Get a simple search criterion by its idprotected SearchUICriteriongetCriterion(SearchUIModel searchModel, String criterionId, Map<String,Object> contextualParameters)Search a criterion in the reference model from its criterion identifier.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 resultsMap<String,SearchUICriterion>getFacetedCriteria(Map<String,Object> contextualParameters)Get the list of faceted search criteria.StringgetPrintUrl(Map<String,Object> contextualParameters)Get the URL for print resultsStringgetPrintUrlPlugin(Map<String,Object> contextualParameters)Get the plugin name for print resultsSearchUIColumngetResultField(String id, Map<String,Object> contextualParameters)Get the column by its identifierMap<String,SearchUIColumn>getResultFields(Map<String,Object> contextualParameters)Get the column for resultsStringgetSearchUrl(Map<String,Object> contextualParameters)Get the URL for searchStringgetSearchUrlPlugin(Map<String,Object> contextualParameters)Get the plugin name for searchvoidservice(ServiceManager manager)Collection<String>setFacetedCriteria(Set<String> baseContentTypeIds, Collection<String> criteriaIds, Map<String,Object> contextualParameters)Set the custom faceted criteria.voidsetResultColumns(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 Detail
-
_searchUICriterionManager
protected ThreadSafeComponentManager<SearchUICriterion> _searchUICriterionManager
ComponentManager forSearchUICriterions.
-
_searchUIColumnManager
protected ThreadSafeComponentManager<SearchUIColumn> _searchUIColumnManager
ComponentManager forSearchUIColumns.
-
-
Constructor Detail
-
CriteriaSearchUIModelWrapper
public CriteriaSearchUIModelWrapper(SearchUIModel model, ServiceManager manager, Context context, org.slf4j.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 Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractSearchUIModel- Throws:
ServiceException
-
setFacetedCriteria
public Collection<String> setFacetedCriteria(Set<String> baseContentTypeIds, Collection<String> criteriaIds, Map<String,Object> contextualParameters) throws Exception
Set 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 Exception
Set 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 ConfigurationException
Configure 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 ConfigurationException
Configure 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
public Map<String,SearchUICriterion> getFacetedCriteria(Map<String,Object> contextualParameters)
Description copied from interface:SearchModelGet the list of faceted search criteria.- Specified by:
getFacetedCriteriain interfaceSearchModel- Specified by:
getFacetedCriteriain interfaceSearchUIModel- Overrides:
getFacetedCriteriain classAbstractSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the list of faceted search criteria.
-
getResultFields
public Map<String,SearchUIColumn> getResultFields(Map<String,Object> contextualParameters)
Description copied from interface:SearchModelGet the column for results- Specified by:
getResultFieldsin interfaceSearchModel- Specified by:
getResultFieldsin interfaceSearchUIModel- Overrides:
getResultFieldsin classAbstractSearchUIModel- Parameters:
contextualParameters- the contextual parameters. Can be null.- Returns:
- the column for results
-
getResultField
public SearchUIColumn getResultField(String id, Map<String,Object> contextualParameters)
Description copied from interface:SearchModelGet the column by its identifier- Parameters:
id- The column idcontextualParameters- the contextual parameters- Returns:
- the column
-
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.
-
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
-
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.- Returns:
- true if sorting on join columns which contains at least one multiple metadata in its path (intermediate ones only) must be allowed.
-
getCriteria
public Map<String,SearchUICriterion> getCriteria(Map<String,Object> contextualParameters)
Description copied from interface:SearchModelGet the list of search criteria in simple mode- Specified by:
getCriteriain interfaceSearchModel- Specified by:
getCriteriain interfaceSearchUIModel- Overrides:
getCriteriain classAbstractSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the list of search criteria in simple mode
-
getCriterion
public SearchUICriterion getCriterion(String id, Map<String,Object> contextualParameters)
Description copied from interface:SearchModelGet a simple search criterion by its id- Parameters:
id- The search criterion idcontextualParameters- the contextual parameters- Returns:
- the criterion or
nullif not found
-
getAdvancedCriteria
public Map<String,SearchUICriterion> getAdvancedCriteria(Map<String,Object> contextualParameters)
Description copied from interface:SearchUIModelGet the list of search criteria in advanced mode- Specified by:
getAdvancedCriteriain interfaceSearchUIModel- Overrides:
getAdvancedCriteriain classAbstractSearchUIModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the list of search criteria in advanced mode
-
-