public class ContentValuesExtractorFactory.SimpleContentValuesExtractor extends Object
Modifier and Type | Field and Description |
---|---|
private Set<String> |
_contentTypes |
private Map<String,Object> |
_fields |
private boolean |
_fullValues |
Constructor and Description |
---|
SimpleContentValuesExtractor(Collection<String> contentTypes,
List<String> fieldNames)
Build a simple ContentValuesExtractor on a list of content types.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAllFields(Map<String,Object> fields)
Add all possible fields to the map.
|
protected void |
addAllMetadatas(Map<String,Object> fields,
MetadataDefinitionHolder defHolder,
String prefix,
boolean parentIsMultiple)
Add all the metadata present in a holder.
|
protected void |
addFields(Map<String,Object> fields,
List<String> fieldNames)
Add the given fields to the map.
|
protected Object |
getValue(Content content,
String fieldName,
Object field,
Locale defaultLocale)
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.
|
protected boolean |
isMultiple(List<MetadataDefinition> metaDefs)
Test if any metadata definition in a chain is multiple or a repeater.
|
ContentValuesExtractorFactory.SimpleContentValuesExtractor |
setFullValues(boolean fullValues)
Whether to return full values or not.
|
private Set<String> _contentTypes
private boolean _fullValues
public SimpleContentValuesExtractor(Collection<String> contentTypes, List<String> fieldNames)
contentTypes
- The content types, can be empty.fieldNames
- The field names.protected Map<String,Object> initializeFields(List<String> fieldNames)
fieldNames
- The field names.protected void addAllFields(Map<String,Object> fields)
fields
- The map of field definitions to fill.protected void addFields(Map<String,Object> fields, List<String> fieldNames)
fields
- The map of field definitions to fill.fieldNames
- The fields to add.protected void addAllMetadatas(Map<String,Object> fields, MetadataDefinitionHolder defHolder, String prefix, boolean parentIsMultiple)
fields
- The field map to fill.defHolder
- The definition holder.prefix
- The metadata path prefix.parentIsMultiple
- true if the parent is multiple.public ContentValuesExtractorFactory.SimpleContentValuesExtractor setFullValues(boolean fullValues)
fullValues
- true to return full values, false otherwise.public Map<String,Object> getValues(Content content, Locale defaultLocale)
content
- The content.defaultLocale
- The default locale for localized values if the content's language is null. Can be null.public Map<String,Object> getValues(Content content, Locale defaultLocale, Map<String,Object> contextualParameters)
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.protected Object getValue(Content content, String fieldName, Object field, Locale defaultLocale)
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.protected boolean isMultiple(List<MetadataDefinition> metaDefs)
metaDefs
- The metadata definition chain.true
if any metadata definition in a chain is multiple or a repeater.