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.
-
-
Field Summary
Fields Modifier and Type Field Description private Set<String>_contentTypesprivate Map<String,Object>_fieldsprivate boolean_fullValues
-
Constructor Summary
Constructors Constructor Description SimpleContentValuesExtractor(Collection<String> contentTypes, List<String> fieldNames)Build a simple ContentValuesExtractor on a list of content types.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>getAllAttributes(ModelItemContainer container)Retrieve all the attributes present in the given container.protected Map<String,Object>getAllFields()Retrieves aMapwith all possible fieldsprotected Map<String,Object>getFields(List<String> fieldNames)Retrieves 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.Map<String,Object>getValues(Content content, Locale defaultLocale)Get the values from the given content.Map<String,Object>getValues(Content content, Locale defaultLocale, Map<String,Object> contextualParameters)Get the values from the given content.protected Map<String,Object>initializeFields(List<String> fieldNames)Initialize the fields from the field names.ContentValuesExtractorFactory.SimpleContentValuesExtractorsetFullValues(boolean fullValues)Whether to return full values or not.
-
-
-
Field Detail
-
_contentTypes
private Set<String> _contentTypes
-
_fullValues
private boolean _fullValues
-
-
Constructor Detail
-
SimpleContentValuesExtractor
public SimpleContentValuesExtractor(Collection<String> contentTypes, List<String> fieldNames)
Build a simple ContentValuesExtractor on a list of content types.- Parameters:
contentTypes- The content types, can be empty.fieldNames- The field names.
-
-
Method Detail
-
initializeFields
protected Map<String,Object> initializeFields(List<String> fieldNames)
Initialize the fields from the field names.- Parameters:
fieldNames- The field names.- Returns:
- The fields definitions (either MetadataDefinition or SystemProperty), indexed by field name.
-
getAllFields
protected Map<String,Object> getAllFields()
Retrieves aMapwith all possible fields- Returns:
- A
Mapwith all possible fields
-
getFields
protected Map<String,Object> getFields(List<String> fieldNames)
Retrieves aMapwith the fields corresponding to the given name- Parameters:
fieldNames- The names of the fields to retrieve- Returns:
- a
Mapwith the fields
-
getAllAttributes
protected Map<String,Object> getAllAttributes(ModelItemContainer container)
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
public ContentValuesExtractorFactory.SimpleContentValuesExtractor setFullValues(boolean fullValues)
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
public Map<String,Object> getValues(Content content, Locale defaultLocale)
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.
-
-