|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.commerce.pricing.ShippingCalculatorImpl
public abstract class ShippingCalculatorImpl
This abstract class is a starting point for some general functionality on calculating
pricing for shipping groups. The implementation of priceShippingGroup checks to make
sure there are items in the shipping group. If there are no items then we reset the
price quote back to zero. If there are items to price for shipping, then we confirm
through the performPricing method that the items in the group should be priced.
For example softgoods, like gift certificates, should not be priced for shipping. The
developer who extends this class should implement the getAmount method which
will be used as the base shipping cost in this calculator. Finally the amount returned
is set into the ShippingPriceInfo. If the addAmount
property is true, then
we take the amount returned and add it to the current ShippingPriceInfo.amount. This allows
surcharges to be tacked on.
The shippingMethod
property should be set to the name of a particular delivery process.
For example: UPS Ground, UPS 2-day or UPS Next Day.
If the ignoreShippingMethod
property is true, then this calculator does not
expose a shipping method name (through getAvailableMethods). In addition this calculator will
always attempt to perform pricing. This option is available if the user is not given a choice
of different shipping methods.
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
ShippingCalculatorImpl()
Constructs an instanceof ShippingCalculatorImpl |
Method Summary | |
---|---|
void |
doStartService()
This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values. |
protected double |
getAmount(Order pOrder,
ShippingPriceInfo pPriceQuote,
ShippingGroup pShippingGroup,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
Return the amount which should be used for the pricing of this shipping group The default implementation just returns the subtotal of the shipping group, or zero if the subtotal cannot be found |
protected double |
getAmount(ShippingPriceInfo pPriceQuote,
ShippingGroup pShippingGroup,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
Deprecated. |
void |
getAvailableMethods(java.util.List pMethods,
ShippingGroup pShippingGroup,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
Get shipping methods available to deliver the shipping group. |
PricingTools |
getPricingTools()
pricing tools to help in calculating prices |
java.lang.String |
getShippingMethod()
Returns property ShippingMethod |
protected boolean |
haveItemsToShip(ShippingGroup pShippingGroup)
Return true if there are any items in the shipping group to price. |
boolean |
isAddAmount()
Returns property AddAmount |
boolean |
isIgnoreShippingMethod()
Returns property IgnoreShippingMethod |
protected boolean |
performPricing(ShippingGroup pShippingGroup)
Return true if we should price the shipping group |
void |
priceShippingGroup(Order pOrder,
ShippingPriceInfo pPriceQuote,
ShippingGroup pShippingGroup,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
Price a shipment within a context |
protected void |
priceShippingPriceInfo(double pAmount,
ShippingPriceInfo pPriceQuote)
Set the amount that is given into the price quote. |
protected void |
resetShippingPriceInfo(ShippingPriceInfo pPriceQuote)
Reset the price quote back to zero |
void |
setAddAmount(boolean pAddAmount)
Sets property AddAmount |
void |
setIgnoreShippingMethod(boolean pIgnoreShippingMethod)
Sets property IgnoreShippingMethod |
void |
setPricingTools(PricingTools pPricingTools)
pricing tools to help in calculating prices |
void |
setShippingMethod(java.lang.String pShippingMethod)
Sets property ShippingMethod |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public ShippingCalculatorImpl()
Method Detail |
---|
public void setPricingTools(PricingTools pPricingTools)
pPricingTools
- new value to setpublic PricingTools getPricingTools()
public void setShippingMethod(java.lang.String pShippingMethod)
public java.lang.String getShippingMethod()
public void setIgnoreShippingMethod(boolean pIgnoreShippingMethod)
public boolean isIgnoreShippingMethod()
public void setAddAmount(boolean pAddAmount)
public boolean isAddAmount()
public void priceShippingGroup(Order pOrder, ShippingPriceInfo pPriceQuote, ShippingGroup pShippingGroup, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
priceShippingGroup
in interface ShippingPricingCalculator
pOrder
- the Order in the context of which pShipment is being priced.pPriceQuote
- ShippingPriceInfo representing the price quote for the shipmentpShippingGroup
- The shipment to pricepPricingModels
- A Collection of RepositoryItems representing PricingModelspProfile
- The user's profilepExtraParameters
- A Map of extra parameters to be used in the pricing, may be null
PricingException
protected double getAmount(Order pOrder, ShippingPriceInfo pPriceQuote, ShippingGroup pShippingGroup, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
PricingException
protected double getAmount(ShippingPriceInfo pPriceQuote, ShippingGroup pShippingGroup, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
PricingException
protected void resetShippingPriceInfo(ShippingPriceInfo pPriceQuote)
protected void priceShippingPriceInfo(double pAmount, ShippingPriceInfo pPriceQuote)
addAmount
property, and if it is true, then we add the base amount to the current amount.
protected boolean haveItemsToShip(ShippingGroup pShippingGroup)
protected boolean performPricing(ShippingGroup pShippingGroup)
public void getAvailableMethods(java.util.List pMethods, ShippingGroup pShippingGroup, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
getAvailableMethods
in interface ShippingPricingCalculator
pMethods
- List of Strings representing shipping methodspShippingGroup
- The shipping group to deliverpPricingModels
- A Collection of RepositoryItems representing PricingModelspProfile
- The user's profilepExtraParameters
- A Map of extra parameters to be used in the pricing, may be null
PricingException
public void doStartService() throws ServiceException
GenericService
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting up
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |