Package org.ametys.cms.search.model
Class DefaultSearchModel
java.lang.Object
org.ametys.cms.search.model.DefaultSearchModel
- All Implemented Interfaces:
SearchModel,Model,ModelItemAccessor,ModelItemContainer
- Direct Known Subclasses:
DefaultSearchUIModel
Default implementation of a
SearchModel.-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.DefaultSearchModel(SearchModel searchModelToCopy, Map<String, Object> contextualParameters) Constructor by copying an existingSearchModel. -
Method Summary
Modifier and TypeMethodDescription_resultItemsToJSON(ViewItemAccessor viewItemAccessor, DefinitionContext context) Converts the search model's result items on a JSON mapvoidaddCriteria(SearchModelCriterionDefinitionHelper criterionDefinitionHelper, Map<String, Object> contextualParameters, String... references) Add criteria to the simple criteria.voidaddFacetedCriteria(SearchModelCriterionDefinitionHelper criterionDefinitionHelper, Map<String, Object> contextualParameters, String... references) Add criteria to the faceted criteria.getContentTypes(Map<String, Object> contextualParameters) Get the list of content types.getCriteria(Map<String, Object> contextualParameters) Retrieves the criteria in simple modegetExcludedContentTypes(Map<String, Object> contextualParameters) Get the list of excluded content types.getFacetedCriteria(Map<String, Object> contextualParameters) Retrieves the faceted criteria.getResultItems(Map<String, Object> contextualParameters) Retrieves the search result itemsgetWorkspace(Map<String, Object> contextualParameters) Get the specific workspace to use.resultItemsToJSON(Map<String, Object> contextualParameters) Converts the search model's result items on a JSON listvoidsetContentTypes(Set<String> cTypes) Set the content types of the modelsvoidsetCriteria(ViewItemContainer criteria) Set the criteriavoidsetExcludedContentTypes(Set<String> cTypes) Set the content types to excludevoidsetFacetedCriteria(ViewItemContainer criteria) Set the faceted criteriavoidsetResultItems(ViewItemContainer resultItems) Set the result itemsvoidsetWorkspace(String workspace) Set the workspaceConverts the search model in a JSON mapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.runtime.model.ModelItemAccessor
getChild, getModelItem, hasModelItemMethods inherited from interface org.ametys.cms.search.model.SearchModel
addCriterion, addFacetedCriterion, getCriterion, getFacetedCriterion, getFamilyId, getId, getModelItems, getResultItem
-
Constructor Details
-
DefaultSearchModel
public DefaultSearchModel()Default constructor. -
DefaultSearchModel
Constructor by copying an existingSearchModel.- Parameters:
searchModelToCopy- TheSearchModelto copycontextualParameters- The contextual parameters
-
-
Method Details
-
getContentTypes
Description copied from interface:SearchModelGet the list of content types.- Specified by:
getContentTypesin interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters.- Returns:
- The list of content types.
-
setContentTypes
Set the content types of the models- Parameters:
cTypes- The content types.
-
getExcludedContentTypes
Description copied from interface:SearchModelGet the list of excluded content types.- Specified by:
getExcludedContentTypesin interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- The list of excluded content types.
-
setExcludedContentTypes
Set the content types to exclude- Parameters:
cTypes- The content types to exclude
-
getCriteria
Description copied from interface:SearchModelRetrieves the criteria in simple mode- Specified by:
getCriteriain interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the criteria in simple mode
-
addCriteria
public void addCriteria(SearchModelCriterionDefinitionHelper criterionDefinitionHelper, Map<String, Object> contextualParameters, String... references) Add criteria to the simple criteria. The created criteria reference the given paths- Parameters:
criterionDefinitionHelper- the criterion definition helpercontextualParameters- the contextual parametersreferences- the paths to the items the criteria will reference
-
setCriteria
Set the criteria- Parameters:
criteria- The criteria to set
-
getFacetedCriteria
Description copied from interface:SearchModelRetrieves the faceted criteria.- Specified by:
getFacetedCriteriain interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the faceted criteria.
-
addFacetedCriteria
public void addFacetedCriteria(SearchModelCriterionDefinitionHelper criterionDefinitionHelper, Map<String, Object> contextualParameters, String... references) Add criteria to the faceted criteria. The created criteria reference the given paths- Parameters:
criterionDefinitionHelper- the criterion definition helpercontextualParameters- the contextual parametersreferences- the paths to the items the criteria will reference
-
setFacetedCriteria
Set the faceted criteria- Parameters:
criteria- The faceted criteria to set
-
getResultItems
Description copied from interface:SearchModelRetrieves the search result items- Specified by:
getResultItemsin interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the search result items
-
setResultItems
Set the result items- Parameters:
resultItems- The result items to set
-
getWorkspace
Description copied from interface:SearchModelGet the specific workspace to use.- Specified by:
getWorkspacein interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters.- Returns:
- the workspace to use when searching, or null to use the default workspace.
-
setWorkspace
Set the workspace- Parameters:
workspace- The workspace to set
-
toJSON
Description copied from interface:SearchModelConverts the search model in a JSON map- Specified by:
toJSONin interfaceSearchModel- Parameters:
contextualParameters- The contextual parameters- Returns:
- the search model as a JSON map
-
resultItemsToJSON
Description copied from interface:SearchModelConverts the search model's result items on a JSON list- Specified by:
resultItemsToJSONin interfaceSearchModel- Parameters:
contextualParameters- The contextual parameters- Returns:
- the result items as a JSON list
-
_resultItemsToJSON
protected List<Object> _resultItemsToJSON(ViewItemAccessor viewItemAccessor, DefinitionContext context) Converts the search model's result items on a JSON map- Parameters:
viewItemAccessor- The result itemscontext- The definition context- Returns:
- the result items as a JSON map
-