atg.commerce.order
Class ShippingGroupCommerceItemRelationship

java.lang.Object
  extended by atg.commerce.order.CommerceIdentifierImpl
      extended by atg.commerce.order.ShippingGroupCommerceItemRelationship
All Implemented Interfaces:
ChangedProperties, CommerceIdentifier, CommerceItemRelationship, Relationship, ShippingGroupRelationship, java.io.Serializable, java.util.Observer

public class ShippingGroupCommerceItemRelationship
extends CommerceIdentifierImpl
implements CommerceItemRelationship, ShippingGroupRelationship, ChangedProperties

An object which represents a relationship between an Item and a ShippingGroup. The two valid relationship types are ShippingQuantity and ShippingQuantityRemaining. ShippingQuantity specifies a particular quantity which is assigned to the ShippingGroup in the Relationship. ShippingQuantityRemaining specifies that the quantity of the CommerceItem not yet assigned to a ShippingGroup should be assigned to the ShippingGroup in the Relationship.

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected static java.lang.String HIGH_BOUND_PROPERTY
           
protected static java.lang.String LOW_BOUND_PROPERTY
           
 
Constructor Summary
ShippingGroupCommerceItemRelationship()
           
 
Method Summary
 void addChangedProperty(java.lang.String pPropertyName)
          Adds a changedProperty
 void clearChangedProperties()
          Clears the changedProperties List
protected  void createRange()
          creates a Range object which is to be used with this Relationship.
 double getAmount()
          This method is not used for this relationship class and therefore should not be called.
 double getAmountByAverage()
          returns the property amountByAverage.
 java.util.Set getChangedProperties()
          Returns the changedProperties
 CommerceItem getCommerceItem()
          Returns the CommerceItem reference.
 double getPercentage()
          This method is not used for this relationship class and therefore should not be called.
 java.lang.Object getPropertyValue(java.lang.String pPropertyName)
          Returns a property value
 long getQuantity()
          Returns the quantity that this Relationship represents.
 atg.core.util.Range getRange()
          The specific commerce items that this relationship reflects.
 double getRawtotalByAverage()
          returns the property rawTotalByAverage.
 java.lang.String getRelationshipClassType()
          Returns the relationshipClassType
 int getRelationshipType()
          Returns the Relationship type.
 java.lang.String getRelationshipTypeAsString()
          Returns the Relationship type as a String.
 MutableRepositoryItem getRepositoryItem()
          Returns the repositoryItem
 long getReturnedQuantity()
          Returns the returnedQuantity
 boolean getSaveAllProperties()
          Returns the saveAllProperties
 ShippingGroup getShippingGroup()
          Returns the ShippingGroup reference.
 int getState()
          returns the ShippingGroupRelationship state.
 java.lang.String getStateAsString()
          returns the Relationship state as a String.
 java.lang.String getStateAsUserResource()
          returns the ShippingGroupCommerceItemRelationship state as a user resource
 java.lang.String getStateDetail()
          Returns the stateDetail
 boolean isAmountByAverageAccurate()
          Returns the property amountByAverageAccurate.
 boolean isChanged()
          Returns the isChanged flag
 void setAmount(double pAmount)
          This method is not used for this relationship class and therefore should not be called.
 void setChanged(boolean pChanged)
          Marks this object as changed
 void setCommerceItem(CommerceItem pCommerceItem)
          Sets the CommerceItem reference.
 void setPercentage(double pPercentage)
          This method is not used for this relationship class and therefore should not be called.
 void setPropertyValue(java.lang.String pPropertyName, java.lang.Object pPropertyValue)
          Sets a property value
 void setQuantity(long pQuantity)
          Sets the quantity that this Relationship represents.
 void setRange(atg.core.util.Range pRange)
           
 void setRelationshipClassType(java.lang.String pRelationshipClassType)
          Sets the relationshipClassType
 void setRelationshipType(int pType)
          Set the Relationship type.
 void setRelationshipTypeAsString(java.lang.String pType)
          Set the Relationship type as a string.
 void setRepositoryItem(MutableRepositoryItem pRepositoryItem)
          Sets the repositoryItem
 void setReturnedQuantity(long pReturnedQuantity)
          Sets the returnedQuantity
 void setSaveAllProperties(boolean pSaveAllProperties)
          Sets the saveAllProperties
 void setShippingGroup(ShippingGroup pGroup)
          Sets the ShippingGroup reference.
 void setState(int pState)
          sets the ShippingGroupRelationship state.
 void setStateAsString(java.lang.String pState)
          Sets the state as a String.
 void setStateDetail(java.lang.String pStateDetail)
          Sets the stateDetail
 void update(java.util.Observable o, java.lang.Object arg)
          This method is called whenever a property in a contained object changes and the containing object needs to be notified.
 
Methods inherited from class atg.commerce.order.CommerceIdentifierImpl
getId, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface atg.commerce.order.CommerceIdentifier
getId
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values

LOW_BOUND_PROPERTY

protected static java.lang.String LOW_BOUND_PROPERTY

HIGH_BOUND_PROPERTY

protected static java.lang.String HIGH_BOUND_PROPERTY
Constructor Detail

ShippingGroupCommerceItemRelationship

public ShippingGroupCommerceItemRelationship()
Method Detail

getRelationshipClassType

public java.lang.String getRelationshipClassType()
Returns the relationshipClassType

Specified by:
getRelationshipClassType in interface Relationship

setRelationshipClassType

public void setRelationshipClassType(java.lang.String pRelationshipClassType)
Sets the relationshipClassType

Specified by:
setRelationshipClassType in interface Relationship

getRelationshipType

public int getRelationshipType()
Returns the Relationship type.

Specified by:
getRelationshipType in interface Relationship

setRelationshipType

public void setRelationshipType(int pType)
                         throws InvalidTypeException
Set the Relationship type.

Specified by:
setRelationshipType in interface Relationship
Throws:
InvalidTypeException

getRelationshipTypeAsString

public java.lang.String getRelationshipTypeAsString()
Returns the Relationship type as a String.


setRelationshipTypeAsString

public void setRelationshipTypeAsString(java.lang.String pType)
                                 throws InvalidTypeException
Set the Relationship type as a string.

Throws:
InvalidTypeException

getState

public int getState()
returns the ShippingGroupRelationship state.

Specified by:
getState in interface CommerceItemRelationship

setState

public void setState(int pState)
sets the ShippingGroupRelationship state.

Specified by:
setState in interface CommerceItemRelationship
Parameters:
pState - the state to set

getStateAsString

public java.lang.String getStateAsString()
returns the Relationship state as a String.


setStateAsString

public void setStateAsString(java.lang.String pState)
Sets the state as a String.


getStateAsUserResource

public java.lang.String getStateAsUserResource()
returns the ShippingGroupCommerceItemRelationship state as a user resource


getStateDetail

public java.lang.String getStateDetail()
Returns the stateDetail

Specified by:
getStateDetail in interface CommerceItemRelationship

setStateDetail

public void setStateDetail(java.lang.String pStateDetail)
Sets the stateDetail

Specified by:
setStateDetail in interface CommerceItemRelationship

getShippingGroup

public ShippingGroup getShippingGroup()
Returns the ShippingGroup reference.

Specified by:
getShippingGroup in interface ShippingGroupRelationship

setShippingGroup

public void setShippingGroup(ShippingGroup pGroup)
Sets the ShippingGroup reference.

Specified by:
setShippingGroup in interface ShippingGroupRelationship

getCommerceItem

public CommerceItem getCommerceItem()
Returns the CommerceItem reference.

Specified by:
getCommerceItem in interface CommerceItemRelationship

setCommerceItem

public void setCommerceItem(CommerceItem pCommerceItem)
Sets the CommerceItem reference.

Specified by:
setCommerceItem in interface CommerceItemRelationship

getQuantity

public long getQuantity()
Returns the quantity that this Relationship represents.

Specified by:
getQuantity in interface CommerceItemRelationship

setQuantity

public void setQuantity(long pQuantity)
Sets the quantity that this Relationship represents.

Specified by:
setQuantity in interface CommerceItemRelationship

getReturnedQuantity

public long getReturnedQuantity()
Returns the returnedQuantity

Specified by:
getReturnedQuantity in interface CommerceItemRelationship

setReturnedQuantity

public void setReturnedQuantity(long pReturnedQuantity)
Sets the returnedQuantity

Specified by:
setReturnedQuantity in interface CommerceItemRelationship

getPercentage

public double getPercentage()
This method is not used for this relationship class and therefore should not be called.


setPercentage

public void setPercentage(double pPercentage)
This method is not used for this relationship class and therefore should not be called.


getAmount

public double getAmount()
This method is not used for this relationship class and therefore should not be called.

Specified by:
getAmount in interface CommerceItemRelationship
Specified by:
getAmount in interface ShippingGroupRelationship

setAmount

public void setAmount(double pAmount)
This method is not used for this relationship class and therefore should not be called.

Specified by:
setAmount in interface CommerceItemRelationship
Specified by:
setAmount in interface ShippingGroupRelationship

getAmountByAverage

public double getAmountByAverage()
returns the property amountByAverage. This property is calculated like this: wholeOrderPrice * shipgrpQuantity / wholeOrderQuantity


getRawtotalByAverage

public double getRawtotalByAverage()
returns the property rawTotalByAverage. This property is calculated like this: wholeOrderRawTotalPrice * shipgrpQuantity / wholeOrderQuantity


setRange

public void setRange(atg.core.util.Range pRange)

getRange

public atg.core.util.Range getRange()
The specific commerce items that this relationship reflects. It is necessary for certain pricing operations.


createRange

protected void createRange()
creates a Range object which is to be used with this Relationship. This method is called by the getRange and is provided so that subclasses can override it to create a specific instance. After the initial call of this method, any subsequent calls will do nothing.


isAmountByAverageAccurate

public boolean isAmountByAverageAccurate()
Returns the property amountByAverageAccurate. It will be set to true if we are confident that the price for all items is equal. That is, there are either no pricing adjustments or the total quantity is 1. For example, imagine 2 shipping groups with 1 $10 widget in each and imagine that there is a buy 1 widget get one free promotion. The average prices will come out as $5 each. So, we return false and the user should be made aware of that.


update

public void update(java.util.Observable o,
                   java.lang.Object arg)
This method is called whenever a property in a contained object changes and the containing object needs to be notified.

Specified by:
update in interface java.util.Observer
Parameters:
o - the object which changed
arg - the name of the property which changed

getSaveAllProperties

public boolean getSaveAllProperties()
Returns the saveAllProperties

Specified by:
getSaveAllProperties in interface ChangedProperties

setSaveAllProperties

public void setSaveAllProperties(boolean pSaveAllProperties)
Sets the saveAllProperties

Specified by:
setSaveAllProperties in interface ChangedProperties

isChanged

public boolean isChanged()
Returns the isChanged flag

Specified by:
isChanged in interface ChangedProperties

setChanged

public void setChanged(boolean pChanged)
Marks this object as changed

Specified by:
setChanged in interface ChangedProperties

getChangedProperties

public java.util.Set getChangedProperties()
Returns the changedProperties

Specified by:
getChangedProperties in interface ChangedProperties

addChangedProperty

public void addChangedProperty(java.lang.String pPropertyName)
Adds a changedProperty

Specified by:
addChangedProperty in interface ChangedProperties

clearChangedProperties

public void clearChangedProperties()
Clears the changedProperties List

Specified by:
clearChangedProperties in interface ChangedProperties

getRepositoryItem

public MutableRepositoryItem getRepositoryItem()
Returns the repositoryItem

Specified by:
getRepositoryItem in interface ChangedProperties

setRepositoryItem

public void setRepositoryItem(MutableRepositoryItem pRepositoryItem)
Sets the repositoryItem

Specified by:
setRepositoryItem in interface ChangedProperties

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String pPropertyName)
Returns a property value

Specified by:
getPropertyValue in interface ChangedProperties
Returns:
returns a property value

setPropertyValue

public void setPropertyValue(java.lang.String pPropertyName,
                             java.lang.Object pPropertyValue)
Sets a property value

Specified by:
setPropertyValue in interface ChangedProperties
Parameters:
pPropertyValue - the value to set for the given property value