Class ProductImagesValueResolver
- java.lang.Object
-
- de.hybris.platform.solrfacetsearch.provider.impl.AbstractValueResolver<ProductModel,java.util.Map<java.lang.String,MediaModel>,java.lang.Object>
-
- de.hybris.platform.commerceservices.search.solrfacetsearch.provider.impl.ProductImagesValueResolver
-
- All Implemented Interfaces:
QualifierProviderAware
,ValueResolver<ProductModel>
public class ProductImagesValueResolver extends AbstractValueResolver<ProductModel,java.util.Map<java.lang.String,MediaModel>,java.lang.Object>
Resolver for product images urls. It selects the first gallery image that supports the requested media format. By default, if parameter mediaFormat is not specified, it tries to retrieve the media format from the indexed property name. By default it finds character "-" and treats following character sequence as a media format. If character "-" is not present, an exception of typeFieldValueProviderException
is thrown. The parsing method can be overridden.Supported parameters:
Parameter Default value Description optional true If false, indicates that the resolved media url should not be null and not an empty string. If these conditions are not met, an exception of type FieldValueProviderException
is thrown.mediaFormat If specified, this is the qualifier of the media format.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.solrfacetsearch.provider.impl.AbstractValueResolver
AbstractValueResolver.ValueResolverContext<T,U>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MEDIA_FORMAT_PARAM
static java.lang.String
MEDIA_FORMAT_PARAM_DEFAULT_VALUE
static java.lang.String
OPTIONAL_PARAM
static boolean
OPTIONAL_PARAM_DEFAULT_VALUE
-
Constructor Summary
Constructors Constructor Description ProductImagesValueResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addFieldValues(InputDocument document, IndexerBatchContext batchContext, IndexedProperty indexedProperty, ProductModel model, AbstractValueResolver.ValueResolverContext<java.util.Map<java.lang.String,MediaModel>,java.lang.Object> resolverContext)
protected void
collectMedias(ProductModel product, com.google.common.collect.Multimap<java.lang.String,java.lang.String> indexedPropertyMediaFormats, java.util.Map<java.lang.String,MediaModel> medias, int mediasToFind)
protected java.lang.String
getMediaFormat(IndexedProperty indexedProperty)
protected java.util.Map<java.lang.String,MediaModel>
loadData(IndexerBatchContext batchContext, java.util.Collection<IndexedProperty> indexedProperties, ProductModel product)
Loads data that is valid in the context of a model.protected java.lang.String
parseIndexedPropertyName(java.lang.String indexedPropertyName)
-
Methods inherited from class de.hybris.platform.solrfacetsearch.provider.impl.AbstractValueResolver
addFieldValue, createLocalSessionContext, doResolve, filterAndAddFieldValues, filterFieldValue, getQualifierProvider, getSessionService, getValueFilters, loadQualifierData, removeLocalSessionContext, resolve, setQualifierProvider, setSessionService, setValueFilters
-
-
-
-
Field Detail
-
OPTIONAL_PARAM
public static final java.lang.String OPTIONAL_PARAM
- See Also:
- Constant Field Values
-
OPTIONAL_PARAM_DEFAULT_VALUE
public static final boolean OPTIONAL_PARAM_DEFAULT_VALUE
- See Also:
- Constant Field Values
-
MEDIA_FORMAT_PARAM
public static final java.lang.String MEDIA_FORMAT_PARAM
- See Also:
- Constant Field Values
-
MEDIA_FORMAT_PARAM_DEFAULT_VALUE
public static final java.lang.String MEDIA_FORMAT_PARAM_DEFAULT_VALUE
-
-
Method Detail
-
addFieldValues
protected void addFieldValues(InputDocument document, IndexerBatchContext batchContext, IndexedProperty indexedProperty, ProductModel model, AbstractValueResolver.ValueResolverContext<java.util.Map<java.lang.String,MediaModel>,java.lang.Object> resolverContext) throws FieldValueProviderException
- Specified by:
addFieldValues
in classAbstractValueResolver<ProductModel,java.util.Map<java.lang.String,MediaModel>,java.lang.Object>
- Throws:
FieldValueProviderException
-
loadData
protected java.util.Map<java.lang.String,MediaModel> loadData(IndexerBatchContext batchContext, java.util.Collection<IndexedProperty> indexedProperties, ProductModel product) throws FieldValueProviderException
Description copied from class:AbstractValueResolver
Loads data that is valid in the context of a model.- Overrides:
loadData
in classAbstractValueResolver<ProductModel,java.util.Map<java.lang.String,MediaModel>,java.lang.Object>
- Parameters:
batchContext
- - the current indexer batch contextindexedProperties
- - the indexed properties that use the same value resolverproduct
- - the values should be resolved for this model instance- Throws:
FieldValueProviderException
- if an error occurs
-
collectMedias
protected void collectMedias(ProductModel product, com.google.common.collect.Multimap<java.lang.String,java.lang.String> indexedPropertyMediaFormats, java.util.Map<java.lang.String,MediaModel> medias, int mediasToFind)
-
getMediaFormat
protected java.lang.String getMediaFormat(IndexedProperty indexedProperty) throws FieldValueProviderException
- Throws:
FieldValueProviderException
-
parseIndexedPropertyName
protected java.lang.String parseIndexedPropertyName(java.lang.String indexedPropertyName)
-
-