com.elasticpath.domain.attribute.impl
Class AttributeValueImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractPersistenceImpl
          extended by com.elasticpath.domain.impl.AbstractValueObjectImpl
              extended by com.elasticpath.domain.attribute.impl.AttributeValueImpl
All Implemented Interfaces:
AttributeValue, AttributeValueWithType, EpDomain, Persistence, ValueObject, java.io.Serializable

public class AttributeValueImpl
extends AbstractValueObjectImpl
implements AttributeValueWithType

The default implementation of AttributeValue.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Constructor Summary
AttributeValueImpl()
           
 
Method Summary
static java.lang.String buildShortTextMultiValues(java.util.List shortTextMultiValues)
          Build up the multi values for short text.
 Attribute getAttribute()
          Get the Attribute corresponding to this value.
 AttributeType getAttributeType()
          Return the AttributeType of this attribute.
 java.lang.Boolean getBooleanValue()
          Get the boolean value.
 java.util.Date getDateValue()
          Get the date value.
 java.math.BigDecimal getDecimalValue()
          Get the decimal value.
 java.lang.Integer getIntegerValue()
          Get the integer value.
 java.lang.String getLocalizedAttributeKey()
          Get the localized attribute key used to get a handle on this attribute value, given the parent object to which the attribute belongs.
 java.lang.String getLongTextValue()
          Get the long text value.
 java.util.List getShortTextMultiValues()
          Get the multi-values for short text.
 java.lang.String getShortTextValue()
          Get the short text value.
 java.lang.String getStringValue()
          Get the string value of the attribute.
 java.lang.Object getValue()
          Get the value of the attribute.
static java.util.List parseShortTextMultiValues(java.lang.String longTextValue)
          Parse the multi values for short text type.
 void setAttribute(Attribute attribute)
          Get the attribute corresponding to this value.
 void setAttributeType(AttributeType attributeType)
          Set the AttributeType of this attribute.
 void setBooleanValue(java.lang.Boolean booleanValue)
          Set the boolean value.
 void setDateValue(java.util.Date dateValue)
          Set the date value.
 void setDecimalValue(java.math.BigDecimal decimalValue)
          Set the decimal value.
 void setIntegerValue(java.lang.Integer integerValue)
          Set the integer value.
 void setLocalizedAttributeKey(java.lang.String localizedAttributeKey)
          Set the localized attribute key used to get a handle on this attribute value, given the parent object to which the attribute belongs.
 void setLongTextValue(java.lang.String longTextValue)
          Set the long text value.
 void setShortTextMultiValues(java.util.List shortTextMultiValues)
          Set the multi-values for short text.
 void setShortTextValue(java.lang.String shortTextValue)
          Set the short text value.
 void setStringValue(java.lang.String stringValue)
          Set the value of the attribute based on the given string value.
 void setValue(java.lang.Object value)
          Set the value of the attribute.
 java.lang.String toString()
          Convert this value to string.
 
Methods inherited from class com.elasticpath.domain.impl.AbstractPersistenceImpl
executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, setUidPk
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.elasticpath.domain.Persistence
executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, setUidPk
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

AttributeValueImpl

public AttributeValueImpl()
Method Detail

buildShortTextMultiValues

public static java.lang.String buildShortTextMultiValues(java.util.List shortTextMultiValues)
Build up the multi values for short text. Using SHORT_TEXT_MULTI_VALUE_SEPERATOR to contact each single value and save it in the longtextvalue.

Parameters:
shortTextMultiValues - the list of multi-value for short text.
Returns:
the storage format of the multi-value for short text.

getAttribute

public Attribute getAttribute()
Get the Attribute corresponding to this value.

Specified by:
getAttribute in interface AttributeValue
Returns:
the Attribute corresponding to this value

getAttributeType

public AttributeType getAttributeType()
Return the AttributeType of this attribute.

Specified by:
getAttributeType in interface AttributeValue
Returns:
the AttributeType of this attribute

getBooleanValue

public java.lang.Boolean getBooleanValue()
Get the boolean value.

Specified by:
getBooleanValue in interface AttributeValueWithType
Returns:
the boolean value

getDateValue

public java.util.Date getDateValue()
Get the date value.

Specified by:
getDateValue in interface AttributeValueWithType
Returns:
the date value

getDecimalValue

public java.math.BigDecimal getDecimalValue()
Get the decimal value.

Specified by:
getDecimalValue in interface AttributeValueWithType
Returns:
the decimal value

getIntegerValue

public java.lang.Integer getIntegerValue()
Get the integer value.

Specified by:
getIntegerValue in interface AttributeValueWithType
Returns:
the integer value

getLocalizedAttributeKey

public java.lang.String getLocalizedAttributeKey()
Get the localized attribute key used to get a handle on this attribute value, given the parent object to which the attribute belongs. For localized attributes, this is the attribute key plus a "_" and language code. For non-localized attributes, the language code suffix is ommitted.

Specified by:
getLocalizedAttributeKey in interface AttributeValue
Returns:
the attribute key

getLongTextValue

public java.lang.String getLongTextValue()
Get the long text value.

Specified by:
getLongTextValue in interface AttributeValueWithType
Returns:
the long text value

getShortTextMultiValues

public java.util.List getShortTextMultiValues()
Get the multi-values for short text.

Specified by:
getShortTextMultiValues in interface AttributeValueWithType
Returns:
the shortTextMultiValues

getShortTextValue

public java.lang.String getShortTextValue()
Get the short text value.

Specified by:
getShortTextValue in interface AttributeValueWithType
Returns:
the short text value

getStringValue

public java.lang.String getStringValue()
Get the string value of the attribute.

Specified by:
getStringValue in interface AttributeValue
Returns:
the string value

getValue

public java.lang.Object getValue()
Get the value of the attribute.

Specified by:
getValue in interface AttributeValue
Returns:
the value

parseShortTextMultiValues

public static java.util.List parseShortTextMultiValues(java.lang.String longTextValue)
Parse the multi values for short text type. The value is stored in longTextValue, and with the SHORT_TEXT_MULTI_VALUE_SEPERATOR as the seperator.

Parameters:
longTextValue - the string value which contains the multi-value for short text.
Returns:
the list of shortText value

setAttribute

public void setAttribute(Attribute attribute)
Get the attribute corresponding to this value.

Specified by:
setAttribute in interface AttributeValue
Parameters:
attribute - the Attribute corresponding to this value

setAttributeType

public void setAttributeType(AttributeType attributeType)
Set the AttributeType of this attribute.

Specified by:
setAttributeType in interface AttributeValue
Parameters:
attributeType - the attribute type.

setBooleanValue

public void setBooleanValue(java.lang.Boolean booleanValue)
Set the boolean value.

Specified by:
setBooleanValue in interface AttributeValueWithType
Parameters:
booleanValue - the boolean value

setDateValue

public void setDateValue(java.util.Date dateValue)
Set the date value.

Specified by:
setDateValue in interface AttributeValueWithType
Parameters:
dateValue - the date value

setDecimalValue

public void setDecimalValue(java.math.BigDecimal decimalValue)
Set the decimal value.

Specified by:
setDecimalValue in interface AttributeValueWithType
Parameters:
decimalValue - the decimal value

setIntegerValue

public void setIntegerValue(java.lang.Integer integerValue)
Set the integer value.

Specified by:
setIntegerValue in interface AttributeValueWithType
Parameters:
integerValue - the integer value

setLocalizedAttributeKey

public void setLocalizedAttributeKey(java.lang.String localizedAttributeKey)
Set the localized attribute key used to get a handle on this attribute value, given the parent object to which the attribute belongs. For localized attributes, this is the attribute key plus a "_" and language code. For non-localized attributes, the language code suffix is ommitted.

Parameters:
localizedAttributeKey - the attribute key

setLongTextValue

public void setLongTextValue(java.lang.String longTextValue)
Set the long text value.

Specified by:
setLongTextValue in interface AttributeValueWithType
Parameters:
longTextValue - the long text value

setShortTextMultiValues

public void setShortTextMultiValues(java.util.List shortTextMultiValues)
Set the multi-values for short text.

Specified by:
setShortTextMultiValues in interface AttributeValueWithType
Parameters:
shortTextMultiValues - the shortTextMultiValues to set

setShortTextValue

public void setShortTextValue(java.lang.String shortTextValue)
Set the short text value.

Specified by:
setShortTextValue in interface AttributeValueWithType
Parameters:
shortTextValue - the short text value

setStringValue

public void setStringValue(java.lang.String stringValue)
                    throws EpBindException
Set the value of the attribute based on the given string value.

Specified by:
setStringValue in interface AttributeValue
Parameters:
stringValue - the string value to set
Throws:
EpBindException - if the given string value is invalid

setValue

public void setValue(java.lang.Object value)
Set the value of the attribute.

Specified by:
setValue in interface AttributeValue
Parameters:
value - the value to set

toString

public java.lang.String toString()
Convert this value to string.

Overrides:
toString in class java.lang.Object
Returns:
the string value