com.elasticpath.domain.attribute
Interface AttributeValueGroup

All Superinterfaces:
EpDomain, Persistence, java.io.Serializable, ValueObject
All Known Implementing Classes:
AttributeValueGroupImpl

public interface AttributeValueGroup
extends ValueObject

This interface represents a group of AttributeValue. It can be aggregated into DOs like Product, Category, etc.


Method Summary
 AttributeValue getAttributeValue(java.lang.String attributeKey, java.util.Locale locale)
          Get the value of an attribute with the specified key in the given locale.
 java.util.Map getAttributeValueMap()
          Returns the attribute value map.
 java.util.List getAttributeValues(AttributeGroup attributeGroup, java.util.Locale locale)
          Get a list of AttributeValues with the given locale for attributes defined in the given attribute group.
 java.util.List getFullAttributeValues(AttributeGroup attributeGroup)
          Get a list of AttributeValues for all attributes defined in the given attribute group.
 java.util.List getFullAttributeValues(AttributeGroup attributeGroup, java.util.Locale locale)
          Get a list of AttributeValues with the given locale for all attributes defined in the given attribute group.
 java.lang.String getStringAttributeValue(java.lang.String attributeKey, java.util.Locale locale)
          Get the value of a string attribute with the specified key in the given locale.
 void removeByAttribute(Attribute attToRemove)
          Removes all attribute values that match incoming attribute key.
 void removeByAttributes(java.util.Set toRemove)
          Removes all attribute values that match incoming attribute keys.
 void setAttributeValue(Attribute attribute, java.util.Locale locale, java.lang.Object value)
          Set the attribute value of the domain object.
 void setAttributeValueMap(java.util.Map attributeValueMap)
          Sets the attribute value map.
 void setStringAttributeValue(Attribute attribute, java.util.Locale locale, java.lang.String stringValue)
          Set the attribute value of the domain object based on the given string value.
 
Methods inherited from interface com.elasticpath.domain.Persistence
executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, setUidPk
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Method Detail

getAttributeValue

AttributeValue getAttributeValue(java.lang.String attributeKey,
                                 java.util.Locale locale)
Get the value of an attribute with the specified key in the given locale. If the attribute value of the given key and locale is not found, it will fallback to the attribute value found in the following sequence:
- a fall-back attribute value with the same language of the given locale
- a fall-back attribute value with the default locale
- a fall-back attribute value without locale

Parameters:
attributeKey - the key of the attribute to be retrieved
locale - the locale for which the attribute is requested
Returns:
the AttributeValue

getAttributeValueMap

java.util.Map getAttributeValueMap()
Returns the attribute value map.

Returns:
the attribute value map

getAttributeValues

java.util.List getAttributeValues(AttributeGroup attributeGroup,
                                  java.util.Locale locale)
Get a list of AttributeValues with the given locale for attributes defined in the given attribute group. If an attribute in the given attribute group has a value, the value will be returned. Otherwise, it won't be returned in the list.

Parameters:
attributeGroup - the attribute group
locale - the locale
Returns:
a list of AttributeValues

getFullAttributeValues

java.util.List getFullAttributeValues(AttributeGroup attributeGroup)
Get a list of AttributeValues for all attributes defined in the given attribute group. If an attribute in the given attribute group has a value, the value will be returned. Otherwise, a null value will be returned.

Parameters:
attributeGroup - the attribute group
Returns:
a list of AttributeValues

getFullAttributeValues

java.util.List getFullAttributeValues(AttributeGroup attributeGroup,
                                      java.util.Locale locale)
Get a list of AttributeValues with the given locale for all attributes defined in the given attribute group. If an attribute in the given attribute group has a value, the value will be returned. Otherwise, a null value will be returned.

Parameters:
attributeGroup - the attribute group
locale - the locale
Returns:
a list of AttributeValues

getStringAttributeValue

java.lang.String getStringAttributeValue(java.lang.String attributeKey,
                                         java.util.Locale locale)
Get the value of a string attribute with the specified key in the given locale.

Parameters:
attributeKey - the key of the attribute to be retrieved
locale - the locale for which the attribute is requested
Returns:
the String value of the attribute

removeByAttribute

void removeByAttribute(Attribute attToRemove)
Removes all attribute values that match incoming attribute key. If incoming attribute is locale dependant, all matching attribute values will be removed.

Parameters:
attToRemove - attribute to remove.

removeByAttributes

void removeByAttributes(java.util.Set toRemove)
Removes all attribute values that match incoming attribute keys. If incoming attribute is locale dependant, all matching attribute values will be removed.

Parameters:
toRemove - contains all attributes to remove.

setAttributeValue

void setAttributeValue(Attribute attribute,
                       java.util.Locale locale,
                       java.lang.Object value)
Set the attribute value of the domain object.

Parameters:
attribute - the attribute to set the value
locale - the locale of the value, set it to null if it's not locale-dependant
value - the value

setAttributeValueMap

void setAttributeValueMap(java.util.Map attributeValueMap)
Sets the attribute value map.

Parameters:
attributeValueMap - the attribute value map

setStringAttributeValue

void setStringAttributeValue(Attribute attribute,
                             java.util.Locale locale,
                             java.lang.String stringValue)
                             throws EpBindException
Set the attribute value of the domain object based on the given string value.

Parameters:
attribute - the attribute to set the value
locale - the locale of the value, set it to null if it's not locale-dependant
stringValue - the string value
Throws:
EpBindException - in case the given string value is invalid