Package org.ametys.cms.search.content
Class ContentValuesExtractorFactory.SimpleContentValuesExtractor
java.lang.Object
org.ametys.cms.search.content.ContentValuesExtractorFactory.SimpleContentValuesExtractor
- All Implemented Interfaces:
ContentValuesExtractorFactory.ContentValuesExtractor
- Enclosing class:
- ContentValuesExtractorFactory
public class ContentValuesExtractorFactory.SimpleContentValuesExtractor
extends Object
implements ContentValuesExtractorFactory.ContentValuesExtractor
A simple ContentValuesExtractor on a list of content types.
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleContentValuesExtractor(Collection<String> contentTypes, List<String> fieldNames) Build a simple ContentValuesExtractor on a list of content types. -
Method Summary
Modifier and TypeMethodDescriptiongetAllAttributes(ModelItemContainer container) Retrieve all the attributes present in the given container.Retrieves aMapwith all possible fieldsRetrieves aMapwith the fields corresponding to the given nameprotected ObjectgetValue(Content content, String fieldName, Object field, Locale defaultLocale, boolean handleExternalizable) Get a value from the Content.Get the values from the given content.Get the values from the given content.initializeFields(List<String> fieldNames) Initialize the fields from the field names.setFullValues(boolean fullValues) Whether to return full values or not.
-
Constructor Details
-
SimpleContentValuesExtractor
Build a simple ContentValuesExtractor on a list of content types.- Parameters:
contentTypes- The content types, can be empty.fieldNames- The field names.
-
-
Method Details
-
initializeFields
Initialize the fields from the field names.- Parameters:
fieldNames- The field names.- Returns:
- The fields definitions (either attribute, property or system property), indexed by field name.
-
getAllFields
Retrieves aMapwith all possible fields- Returns:
- A
Mapwith all possible fields
-
getFields
Retrieves aMapwith the fields corresponding to the given name- Parameters:
fieldNames- The names of the fields to retrieve- Returns:
- a
Mapwith the fields
-
getAllAttributes
Retrieve all the attributes present in the given container.- Parameters:
container- The model item container.- Returns:
- All the attributes present in the given container.
-
setFullValues
Description copied from interface:ContentValuesExtractorFactory.ContentValuesExtractorWhether to return full values or not.- Specified by:
setFullValuesin interfaceContentValuesExtractorFactory.ContentValuesExtractor- Parameters:
fullValues- true to return full values, false otherwise.- Returns:
- The ContentValuesExtractor itself.
-
getValues
Description copied from interface:ContentValuesExtractorFactory.ContentValuesExtractorGet the values from the given content.- Specified by:
getValuesin interfaceContentValuesExtractorFactory.ContentValuesExtractor- Parameters:
content- The content.defaultLocale- The default locale for localized values if the content's language is null. Can be null.- Returns:
- the extracted values.
-
getValues
public Map<String,Object> getValues(Content content, Locale defaultLocale, Map<String, Object> contextualParameters) Description copied from interface:ContentValuesExtractorFactory.ContentValuesExtractorGet the values from the given content.- Specified by:
getValuesin interfaceContentValuesExtractorFactory.ContentValuesExtractor- Parameters:
content- The content.defaultLocale- The default locale for localized values if the content's language is null. Can be null.contextualParameters- The search contextual parameters.- Returns:
- the extracted values.
-
getValue
protected Object getValue(Content content, String fieldName, Object field, Locale defaultLocale, boolean handleExternalizable) Get a value from the Content.- Parameters:
content- The content.fieldName- The field name.field- The field definition.defaultLocale- The default locale for localized values if the content's language is null. Can be null.handleExternalizable- false to simply get current value on externalizable, true to get a json object with current value and status- Returns:
- The value.
-