public abstract class ShippingCalculatorImpl extends GenericService implements ShippingPricingCalculator
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.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
ShippingCalculatorImpl()
Constructs an instanceof ShippingCalculatorImpl
|
Modifier and Type | Method and Description |
---|---|
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
|
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public ShippingCalculatorImpl()
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 nullPricingException
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 nullPricingException
public void doStartService() throws ServiceException
GenericService
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting up