atg.commerce.pricing
Class GWPInfo

java.lang.Object
  extended by atg.commerce.pricing.GWPInfo

public class GWPInfo
extends java.lang.Object

Contains information on the state of a GWP promotion. There will be an instance of this class for each GWP promotion that qualifies and free gift selection given.
e.g. if a promotion gives away 1 shirt and 3 item in a GWP category then there would be two GWPInfo objects.
There is a 1-1 mapping between GWPInfo objects and the order markers that will be created to store information against the order.
If a GWP promotion applies a discount more than once or qualifies more than once then there is still only a single instance however the quantity is incremented instead.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  int mGiftHashCode
           
protected  RepositoryItem mMarker
           
protected  java.util.Map mOrderDetailsMap
           
protected  java.lang.String mPromotionId
           
protected  long mQuantity
           
protected  java.util.Map<java.lang.String,java.lang.Long> mTargetedItemsMap
           
protected  long mTargetedQuantity
           
 
Constructor Summary
GWPInfo(java.lang.String pPromotionId, DiscountDetail pDiscountDetail)
          Constructor uses the discount detail from the GWP promotion to set the properties.
 
Method Summary
 int getGiftHashCode()
          Getter for the hash code of the discount detail PMDL that applies to this gift selection.
 java.util.UUID getLastTargetSetUUID()
          Get property LastTargetSetUUID
 RepositoryItem getMarker()
          Getter for the existing order marker related to this info (if any)
 java.util.Map getOrderDetailsMap()
          Getter for the map of other order marker properties.
 java.lang.String getPromotionId()
          Getter for the promotion id for this GWPInfo
 long getQuantity()
          Getter for the total free quantity this gift selection offers.
 java.util.Map<java.lang.String,java.lang.Long> getTargetedItemsMap()
          Getter for the map of commerce item id to quantity targeted to be free.
 long getTargetedQuantity()
          Getter for the total targeted quantity for this gift selection, should add up to the sum of all quantities in the targetedItemsMap.
 void increaseQuantity(DiscountDetail pDiscountDetail)
          Method to increase the quantity by the amount in the given discount detail
 void setGiftHashCode(int pGiftHashCode)
          Setter for the hash code of the discount detail PMDL that applies to this gift selection.
 void setLastTargetSetUUID(java.util.UUID pLastTargetSetUUID)
          Set property LastTargetSetUUID.
 void setMarker(RepositoryItem pMarker)
          Setter for the existing order marker related to this info (if any)
 void setOrderDetailsMap(java.util.Map pOrderDetailsMap)
          Setter for the map of other order marker properties.
 void setPromotionId(java.lang.String pPromotionId)
          Setter for the promotion id for this GWPInfo
 void setQuantity(long pQuantity)
          Setter for the total free quantity this gift selection offers.
 void setTargetedItemsMap(java.util.Map<java.lang.String,java.lang.Long> pTargetedItemsMap)
          Setter for the map of commerce item id to quantity targeted to be free.
 void setTargetedQuantity(long pTargetedQuantity)
          Setter for the total targeted quantity for this gift selection, should add up to the sum of all quantities in the targetedItemsMap.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_VERSION

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

See Also:
Constant Field Values

mPromotionId

protected java.lang.String mPromotionId

mGiftHashCode

protected int mGiftHashCode

mQuantity

protected long mQuantity

mTargetedQuantity

protected long mTargetedQuantity

mOrderDetailsMap

protected java.util.Map mOrderDetailsMap

mTargetedItemsMap

protected java.util.Map<java.lang.String,java.lang.Long> mTargetedItemsMap

mMarker

protected RepositoryItem mMarker
Constructor Detail

GWPInfo

public GWPInfo(java.lang.String pPromotionId,
               DiscountDetail pDiscountDetail)
        throws PricingException
Constructor uses the discount detail from the GWP promotion to set the properties.

Parameters:
pPromotionId - String promotion id for this GWPInfo
pDiscountDetail - GWP promotion discount detail for this gift
Throws:
PricingException - if the parameters are not valid
Method Detail

getPromotionId

public java.lang.String getPromotionId()
Getter for the promotion id for this GWPInfo

Returns:
String promotion repository id

setPromotionId

public void setPromotionId(java.lang.String pPromotionId)
Setter for the promotion id for this GWPInfo

Parameters:
pPromotionId - String promotion repository id

getGiftHashCode

public int getGiftHashCode()
Getter for the hash code of the discount detail PMDL that applies to this gift selection.

Returns:
int hash code

setGiftHashCode

public void setGiftHashCode(int pGiftHashCode)
Setter for the hash code of the discount detail PMDL that applies to this gift selection.

Parameters:
pGiftHashCode - int hash code

getQuantity

public long getQuantity()
Getter for the total free quantity this gift selection offers.

Returns:
long quantity

setQuantity

public void setQuantity(long pQuantity)
Setter for the total free quantity this gift selection offers.

Parameters:
pQuantity - long quantity

getTargetedQuantity

public long getTargetedQuantity()
Getter for the total targeted quantity for this gift selection, should add up to the sum of all quantities in the targetedItemsMap.

Returns:
long quantity

setTargetedQuantity

public void setTargetedQuantity(long pTargetedQuantity)
Setter for the total targeted quantity for this gift selection, should add up to the sum of all quantities in the targetedItemsMap.

Parameters:
pTargetedQuantity - long quantity

getOrderDetailsMap

public java.util.Map getOrderDetailsMap()
Getter for the map of other order marker properties.

Returns:
Map

setOrderDetailsMap

public void setOrderDetailsMap(java.util.Map pOrderDetailsMap)
Setter for the map of other order marker properties.

Parameters:
pOrderDetailsMap - Map

getTargetedItemsMap

public java.util.Map<java.lang.String,java.lang.Long> getTargetedItemsMap()
Getter for the map of commerce item id to quantity targeted to be free.

Returns:
Map

setTargetedItemsMap

public void setTargetedItemsMap(java.util.Map<java.lang.String,java.lang.Long> pTargetedItemsMap)
Setter for the map of commerce item id to quantity targeted to be free.

Parameters:
pTargetedItemsMap - Map

getMarker

public RepositoryItem getMarker()
Getter for the existing order marker related to this info (if any)

Returns:
RepositoryItem GWP order marker.

setMarker

public void setMarker(RepositoryItem pMarker)
Setter for the existing order marker related to this info (if any)

Parameters:
pMarker - RepositoryItem marker

setLastTargetSetUUID

public void setLastTargetSetUUID(java.util.UUID pLastTargetSetUUID)
Set property LastTargetSetUUID.

Parameters:
pLastTargetSetUUID - the UUID for the last target set that increased this GWPInfo quantity

getLastTargetSetUUID

public java.util.UUID getLastTargetSetUUID()
Get property LastTargetSetUUID

Returns:
the UUID for the last target set that increased this GWPInfo quantity

increaseQuantity

public void increaseQuantity(DiscountDetail pDiscountDetail)
                      throws PricingException
Method to increase the quantity by the amount in the given discount detail

Parameters:
pDiscountDetail - DiscountDetail to get quantity to add
Throws:
PricingException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object