Class DefaultPropertyValueService
- java.lang.Object
-
- com.hybris.cockpitng.dataaccess.services.impl.DefaultPropertyValueService
-
- All Implemented Interfaces:
PropertyValueService
public class DefaultPropertyValueService extends java.lang.Object implements PropertyValueService
Default implementation of service for reading and setting property values of an object.
-
-
Constructor Summary
Constructors Constructor Description DefaultPropertyValueService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanProcessValueMap(java.util.Map valueMap, java.lang.String propertyQualifier)protected PropertyReadResultcreatePropertyResult(java.lang.Object sourceObject, java.util.List<java.util.Locale> locales, java.lang.String qualifier)protected ExpressionResolverFactorygetResolverFactory()protected ExpressionResolverFactorygetRestrictedResolverFactory()protected PropertyReadResulthandleEvaluationException(org.springframework.expression.spel.SpelEvaluationException e)PropertyReadResultreadRestrictedValue(java.lang.Object sourceObject, java.lang.String propertyQualifier)Read property value from source object.java.util.Map<java.util.Locale,PropertyReadResult>readRestrictedValue(java.lang.Object sourceObject, java.lang.String qualifier, java.util.List<java.util.Locale> locales)Read localized qualifier values from source object.java.util.Map<java.lang.String,PropertyReadResult>readRestrictedValues(java.lang.Object sourceObject, java.util.List<java.lang.String> propertyQualifiers)Read property values from source object.java.util.Map<java.lang.String,PropertyReadResult>readRestrictedValues(java.lang.Object sourceObject, java.util.List<java.lang.String> qualifiers, java.util.List<java.util.Locale> locales)Read qualifiers values from the source object.java.lang.ObjectreadValue(java.lang.Object sourceObject, java.lang.String qualifier)Calls the readValues method and return a value of an attribute.java.util.Map<java.util.Locale,java.lang.Object>readValue(java.lang.Object sourceObject, java.lang.String qualifier, java.util.List<java.util.Locale> locales)Read localized qualifier values from source object.java.util.Map<java.lang.String,java.lang.Object>readValues(java.lang.Object sourceObject, java.util.List<java.lang.String> qualifiers)Calls the readValues method and return a map of attributes and the corresponding value of each attribute.java.util.Map<java.lang.String,java.lang.Object>readValues(java.lang.Object sourceObject, java.util.List<java.lang.String> qualifiers, java.util.List<java.util.Locale> locales)Read qualifiers values from the source object.voidsetLocalizedValue(java.lang.Object sourceObject, java.lang.String propertyQualifier, java.lang.Object value, java.util.Locale locale)Sets the value for the specified property and locale.voidsetResolverFactory(ExpressionResolverFactory resolverFactory)voidsetRestrictedResolverFactory(ExpressionResolverFactory restrictedResolverFactory)
-
-
-
Method Detail
-
setLocalizedValue
public void setLocalizedValue(java.lang.Object sourceObject, java.lang.String propertyQualifier, java.lang.Object value, java.util.Locale locale)Description copied from interface:PropertyValueServiceSets the value for the specified property and locale. Assumes the the object has a setter with aLocaleas second argument for the given property.- Specified by:
setLocalizedValuein interfacePropertyValueService- Parameters:
sourceObject- a object to write a property with given qualifier and localepropertyQualifier- qualifier of property value to setvalue- value to setlocale- locale for property value
-
readValue
public java.lang.Object readValue(java.lang.Object sourceObject, java.lang.String qualifier)Calls the readValues method and return a value of an attribute.- Specified by:
readValuein interfacePropertyValueService- Parameters:
sourceObject- object to read fromqualifier- property qualifier to read- Returns:
- corresponding property value.
-
readValues
public java.util.Map<java.lang.String,java.lang.Object> readValues(java.lang.Object sourceObject, java.util.List<java.lang.String> qualifiers)Calls the readValues method and return a map of attributes and the corresponding value of each attribute.- Specified by:
readValuesin interfacePropertyValueService- Parameters:
sourceObject- object to read fromqualifiers- a list of property qualifiers to read- Returns:
- map contains all property qualifiers with corresponding values.
-
readRestrictedValue
public PropertyReadResult readRestrictedValue(java.lang.Object sourceObject, java.lang.String propertyQualifier)
Description copied from interface:PropertyValueServiceRead property value from source object. Property is first check, whether user may read it.- Specified by:
readRestrictedValuein interfacePropertyValueService- Parameters:
sourceObject- object to read frompropertyQualifier- property qualifier to read- Returns:
- corresponding property read result.
-
readRestrictedValues
public java.util.Map<java.lang.String,PropertyReadResult> readRestrictedValues(java.lang.Object sourceObject, java.util.List<java.lang.String> propertyQualifiers)
Description copied from interface:PropertyValueServiceRead property values from source object. Every property is first check, whether user may read it.- Specified by:
readRestrictedValuesin interfacePropertyValueService- Parameters:
sourceObject- object to read frompropertyQualifiers- a list of property qualifiers to read- Returns:
- map contains all property qualifiers with corresponding read result.
-
readValue
public java.util.Map<java.util.Locale,java.lang.Object> readValue(java.lang.Object sourceObject, java.lang.String qualifier, java.util.List<java.util.Locale> locales)Description copied from interface:PropertyValueServiceRead localized qualifier values from source object. The returning map holds a locale as key and the value of this map holds the corresponding localized value of the property.- Specified by:
readValuein interfacePropertyValueService- Parameters:
sourceObject- object to read fromqualifier- property qualifier to readlocales- a list of locales to read- Returns:
- map where the key holds a @Locale object and the value of this map holds the corresponding value of the qualifier.
-
readRestrictedValue
public java.util.Map<java.util.Locale,PropertyReadResult> readRestrictedValue(java.lang.Object sourceObject, java.lang.String qualifier, java.util.List<java.util.Locale> locales)
Description copied from interface:PropertyValueServiceRead localized qualifier values from source object. Every property is first check, whether user may read it. The returning map holds a locale as key and the value of this map holds the corresponding localized value of the property.- Specified by:
readRestrictedValuein interfacePropertyValueService- Parameters:
sourceObject- object to read fromqualifier- property qualifier to readlocales- a list of locales to read- Returns:
- map where the key holds a @Locale object and the value of this map holds the corresponding value of the qualifier.
-
canProcessValueMap
protected boolean canProcessValueMap(java.util.Map valueMap, java.lang.String propertyQualifier)
-
readValues
public java.util.Map<java.lang.String,java.lang.Object> readValues(java.lang.Object sourceObject, java.util.List<java.lang.String> qualifiers, java.util.List<java.util.Locale> locales)Description copied from interface:PropertyValueServiceRead qualifiers values from the source object. Also Localized property values will be read.- Specified by:
readValuesin interfacePropertyValueService- Parameters:
sourceObject- is the instance of a typequalifiers- is a list of the attribute qualifiers of the typelocales- is a list of locales- Returns:
- a map of attributes and their corresponding localized values
-
readRestrictedValues
public java.util.Map<java.lang.String,PropertyReadResult> readRestrictedValues(java.lang.Object sourceObject, java.util.List<java.lang.String> qualifiers, java.util.List<java.util.Locale> locales)
Description copied from interface:PropertyValueServiceRead qualifiers values from the source object. Also Localized property values will be read. Every property is first check, whether user may read it.- Specified by:
readRestrictedValuesin interfacePropertyValueService- Parameters:
sourceObject- is a instance of a type.qualifiers- is a list of the property qualifiers of the type.locales- is a list of locales.- Returns:
- map contains all qualifiers with corresponding localized values.
-
createPropertyResult
protected PropertyReadResult createPropertyResult(java.lang.Object sourceObject, java.util.List<java.util.Locale> locales, java.lang.String qualifier)
-
handleEvaluationException
protected PropertyReadResult handleEvaluationException(org.springframework.expression.spel.SpelEvaluationException e)
-
getResolverFactory
protected ExpressionResolverFactory getResolverFactory()
-
setResolverFactory
public void setResolverFactory(ExpressionResolverFactory resolverFactory)
-
getRestrictedResolverFactory
protected ExpressionResolverFactory getRestrictedResolverFactory()
-
setRestrictedResolverFactory
public void setRestrictedResolverFactory(ExpressionResolverFactory restrictedResolverFactory)
-
-