Class ProductImagesValueResolver
java.lang.Object
de.hybris.platform.solrfacetsearch.provider.impl.AbstractValueResolver<ProductModel,Map<String,MediaModel>,Object>
de.hybris.platform.commerceservices.search.solrfacetsearch.provider.impl.ProductImagesValueResolver
- All Implemented Interfaces:
QualifierProviderAware,ValueResolver<ProductModel>
public class ProductImagesValueResolver
extends AbstractValueResolver<ProductModel,Map<String,MediaModel>,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 type
FieldValueProviderException 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 FieldValueProviderExceptionis 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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddFieldValues(InputDocument document, IndexerBatchContext batchContext, IndexedProperty indexedProperty, ProductModel model, AbstractValueResolver.ValueResolverContext<Map<String, MediaModel>, Object> resolverContext) protected voidcollectMedias(ProductModel product, com.google.common.collect.Multimap<String, String> indexedPropertyMediaFormats, Map<String, MediaModel> medias, int mediasToFind) protected StringgetMediaFormat(IndexedProperty indexedProperty) protected Map<String,MediaModel> loadData(IndexerBatchContext batchContext, Collection<IndexedProperty> indexedProperties, ProductModel product) Loads data that is valid in the context of a model.protected StringparseIndexedPropertyName(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 Details
-
OPTIONAL_PARAM
- See Also:
-
OPTIONAL_PARAM_DEFAULT_VALUE
public static final boolean OPTIONAL_PARAM_DEFAULT_VALUE- See Also:
-
MEDIA_FORMAT_PARAM
- See Also:
-
MEDIA_FORMAT_PARAM_DEFAULT_VALUE
-
-
Constructor Details
-
ProductImagesValueResolver
public ProductImagesValueResolver()
-
-
Method Details
-
addFieldValues
protected void addFieldValues(InputDocument document, IndexerBatchContext batchContext, IndexedProperty indexedProperty, ProductModel model, AbstractValueResolver.ValueResolverContext<Map<String, MediaModel>, throws FieldValueProviderExceptionObject> resolverContext) - Specified by:
addFieldValuesin classAbstractValueResolver<ProductModel,Map<String, MediaModel>, Object> - Throws:
FieldValueProviderException
-
loadData
protected Map<String,MediaModel> loadData(IndexerBatchContext batchContext, Collection<IndexedProperty> indexedProperties, ProductModel product) throws FieldValueProviderException Description copied from class:AbstractValueResolverLoads data that is valid in the context of a model.- Overrides:
loadDatain classAbstractValueResolver<ProductModel,Map<String, MediaModel>, 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<String, String> indexedPropertyMediaFormats, Map<String, MediaModel> medias, int mediasToFind) -
getMediaFormat
- Throws:
FieldValueProviderException
-
parseIndexedPropertyName
-