com.elasticpath.domain.attribute.impl
Class AttributeValueGroupImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractPersistenceImpl
          extended by com.elasticpath.domain.impl.AbstractEntityImpl
              extended by com.elasticpath.domain.attribute.impl.AttributeValueGroupImpl
All Implemented Interfaces:
AttributeValueGroup, Entity, EpDomain, Persistence, ValueObject, java.io.Serializable

public class AttributeValueGroupImpl
extends AbstractEntityImpl
implements AttributeValueGroup

This is a default implementation of AttributeValueGroup.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Constructor Summary
AttributeValueGroupImpl()
           
 
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.
 ElasticPath getElasticPath()
          Get the ElasticPath singleton.
 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 setDefaultValues()
          Set default values for those fields need default values.
 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 class com.elasticpath.domain.impl.AbstractEntityImpl
convertAttributeGroupAttributes, getGuid, setGuid
 
Methods inherited from class com.elasticpath.domain.impl.AbstractPersistenceImpl
executeBeforePersistAction, getUidPk, isPersistent, setUidPk
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.domain.Persistence
executeBeforePersistAction, getUidPk, isPersistent, setUidPk
 
Methods inherited from interface com.elasticpath.domain.EpDomain
setElasticPath
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

AttributeValueGroupImpl

public AttributeValueGroupImpl()
Method Detail

getAttributeValue

public AttributeValue getAttributeValue(java.lang.String attributeKey,
                                        java.util.Locale locale)
Get the value of an attribute with the specified key in the given locale.

Specified by:
getAttributeValue in interface AttributeValueGroup
Parameters:
attributeKey - the key of the attribute to be retrieved
locale - the locale for which the attribute is requested
Returns:
the AttributeValue

getAttributeValueMap

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

Specified by:
getAttributeValueMap in interface AttributeValueGroup
Returns:
the attribute value map

getAttributeValues

public 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.

Specified by:
getAttributeValues in interface AttributeValueGroup
Parameters:
attributeGroup - the attribute group
locale - the locale
Returns:
a list of AttributeValues

getElasticPath

public ElasticPath getElasticPath()
Get the ElasticPath singleton.

Specified by:
getElasticPath in interface EpDomain
Overrides:
getElasticPath in class AbstractEpDomainImpl
Returns:
elasticpath the ElasticPath singleton.

getFullAttributeValues

public 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.

Specified by:
getFullAttributeValues in interface AttributeValueGroup
Parameters:
attributeGroup - the attribute group
Returns:
a list of AttributeValues

getFullAttributeValues

public 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.

Specified by:
getFullAttributeValues in interface AttributeValueGroup
Parameters:
attributeGroup - the attribute group
locale - the locale
Returns:
a list of AttributeValues

getStringAttributeValue

public 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.

Specified by:
getStringAttributeValue in interface AttributeValueGroup
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

public 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.

Specified by:
removeByAttribute in interface AttributeValueGroup
Parameters:
attToRemove - attribute to remove.

removeByAttributes

public 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.

Specified by:
removeByAttributes in interface AttributeValueGroup
Parameters:
toRemove - contains all attributes to remove.

setAttributeValue

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

Specified by:
setAttributeValue in interface AttributeValueGroup
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

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

Specified by:
setAttributeValueMap in interface AttributeValueGroup
Parameters:
attributeValueMap - the attribute value map

setDefaultValues

public void setDefaultValues()
Set default values for those fields need default values.

Specified by:
setDefaultValues in interface Persistence
Overrides:
setDefaultValues in class AbstractEntityImpl

setStringAttributeValue

public 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.

Specified by:
setStringAttributeValue in interface AttributeValueGroup
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