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
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 aMap
with all possible fieldsprotected Map<String,Object>
getFields(List<String> fieldNames)
Retrieves aMap
with the fields corresponding to the given nameprotected Object
getValue(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.SimpleContentValuesExtractor
setFullValues(boolean fullValues)
Whether to return full values or not.
-
-
-
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 aMap
with all possible fields- Returns:
- A
Map
with all possible fields
-
getFields
protected Map<String,Object> getFields(List<String> fieldNames)
Retrieves aMap
with the fields corresponding to the given name- Parameters:
fieldNames
- The names of the fields to retrieve- Returns:
- a
Map
with 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.ContentValuesExtractor
Whether to return full values or not.- Specified by:
setFullValues
in 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.ContentValuesExtractor
Get the values from the given content.- Specified by:
getValues
in 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.ContentValuesExtractor
Get the values from the given content.- Specified by:
getValues
in 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.
-
-