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
FieldsModifier and TypeFieldDescriptionprotected ThreadSafeComponentManager<SearchUIColumn>ComponentManager forSearchUIColumns.protected ThreadSafeComponentManager<SearchUICriterion>ComponentManager forSearchUICriterions.Fields inherited from class org.ametys.cms.search.ui.model.AbstractSearchUIModel
_advancedSearchCriteria, _columns, _context, _cTypeEP, _cTypes, _excludedCTypes, _facetedCriteria, _logger, _manager, _searchCriteria, _searchModelHelper, DEFAULT_EXPORT_CSV_URL, DEFAULT_EXPORT_DOC_URL, DEFAULT_EXPORT_XML_URL, DEFAULT_PRINT_URL, DEFAULT_SEARCH_URL, DEFAULT_URL_PLUGIN -
Constructor Summary
ConstructorsConstructorDescriptionCriteriaSearchUIModelWrapper(SearchUIModel model, ServiceManager manager, Context context, Logger logger) Build a model wrapper. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.booleanIndicates if sorting on join columns which contain at least onemultipledefinitionin its path (intermediate ones only) must be allowed.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.getAdvancedCriteria(Map<String, Object> contextualParameters) Get the list of search criteria in advanced modeprotected SearchUIColumnSearch 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 SearchUICriteriongetCriterion(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 searchvoidservice(ServiceManager manager) 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, setResultFieldsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.cms.search.ui.model.SearchUIModel
getAdvancedCriterion, getFacetedCriterion
-
Field Details
-
_searchUICriterionManager
ComponentManager forSearchUICriterions. -
_searchUIColumnManager
ComponentManager forSearchUIColumns.
-
-
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:
servicein interfaceServiceable- Overrides:
servicein 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: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
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
Description copied from interface:SearchModelGet the column by its identifier- Parameters:
id- The column idcontextualParameters- the contextual parameters- Returns:
- the column
-
getContentTypes
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
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
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
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
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
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
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
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
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
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
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
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
Description copied from interface:SearchUIModelIndicates if sorting on join columns which contain at least onemultipledefinitionin 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: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
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
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
-