atg.commerce.pricing
Class PropertyRangeShippingCalculator

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.pricing.ShippingCalculatorImpl
              extended by atg.commerce.pricing.DoubleRangeShippingCalculator
                  extended by atg.commerce.pricing.PropertyRangeShippingCalculator
All Implemented Interfaces:
ShippingPricingCalculator, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class PropertyRangeShippingCalculator
extends DoubleRangeShippingCalculator

A shipping calculator that determines the shipping price based on the summing the values of a specific property of all the items in the shipping group. The service is configured through the ranges property. With the given array of price range configurations (format: low:high:price) the service parses the values into their double format for use in calculating shipping costs.

For example:

 ranges=00.00:15.99:4.50,\
        16.00:30.99:6.00,\
        31.00:40.99:7.25,\
        41.00:MAX_VALUE:10.00
 
Note: the keyword MAX_VALUE indicates a top end

If the property addAmount is true then instead of setting the price quote amount to the value of the amount property, the calculator adds the amount to the current amount in the price quote. This can be used to configure a "surcharge" calculator, which increases the shipping price.

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.

Set the propertyName property to the name of the property that you want to sum across all items. (e.g. "weight" - which would then calculate the total weight of all the items in the order) The property value will be extracted from the catalogRef of the CommerceItem (aka SKU) if the useCatalogRef property is set to true, otherwise the product will be used as the source.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.commerce.pricing.DoubleRangeShippingCalculator
mAmounts, MAX_VALUE_KEY, mHighRanges, mLowRanges, TOKEN
 
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
PropertyRangeShippingCalculator()
          Constructs an instanceof PropertyRangeShippingCalculator
 
Method Summary
 OrderManager getOrderManager()
          Return the OrderManager property.
 java.lang.String getPropertyName()
          Returns property PropertyName
protected  double getRangeComparisonValue(Order pOrder, ShippingGroup pShippingGroup)
          Return the value which should be used as a comparison between the range values
protected  double getRangeComparisonValue(ShippingGroup pShippingGroup)
          Deprecated.  
 boolean isUseCatalogRef()
          Returns property UseCatalogRef.
 void setOrderManager(OrderManager pOrderManager)
          Set the OrderManager property.
 void setPropertyName(java.lang.String pPropertyName)
          Sets property PropertyName
 void setUseCatalogRef(boolean pUseCatalogRef)
          Sets property UseCatalogRef
 
Methods inherited from class atg.commerce.pricing.DoubleRangeShippingCalculator
doStartService, getAmount, getRanges, initializeRanges, setRanges
 
Methods inherited from class atg.commerce.pricing.ShippingCalculatorImpl
getAmount, getAvailableMethods, getPricingTools, getShippingMethod, haveItemsToShip, isAddAmount, isIgnoreShippingMethod, performPricing, priceShippingGroup, priceShippingPriceInfo, resetShippingPriceInfo, setAddAmount, setIgnoreShippingMethod, setPricingTools, setShippingMethod
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
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

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

PropertyRangeShippingCalculator

public PropertyRangeShippingCalculator()
Constructs an instanceof PropertyRangeShippingCalculator

Method Detail

setUseCatalogRef

public void setUseCatalogRef(boolean pUseCatalogRef)
Sets property UseCatalogRef


isUseCatalogRef

public boolean isUseCatalogRef()
Returns property UseCatalogRef.

Returns:
true if the property value should be extracted from the catalogRef (aka sku). Otherwise extract the information from the product object

setPropertyName

public void setPropertyName(java.lang.String pPropertyName)
Sets property PropertyName


getPropertyName

public java.lang.String getPropertyName()
Returns property PropertyName


setOrderManager

public void setOrderManager(OrderManager pOrderManager)
Set the OrderManager property.


getOrderManager

public OrderManager getOrderManager()
Return the OrderManager property.


getRangeComparisonValue

protected double getRangeComparisonValue(ShippingGroup pShippingGroup)
                                  throws PricingException
Deprecated. 

Return the value which should be used as a comparison between the range values

Specified by:
getRangeComparisonValue in class DoubleRangeShippingCalculator
Parameters:
pShippingGroup - the group that should be inspected for a value which falls between configured range values.
Returns:
the sum of all the Number values fetched from the configured property
Throws:
PricingException - if there was a problem discovering the range comparison value

getRangeComparisonValue

protected double getRangeComparisonValue(Order pOrder,
                                         ShippingGroup pShippingGroup)
                                  throws PricingException
Return the value which should be used as a comparison between the range values

Overrides:
getRangeComparisonValue in class DoubleRangeShippingCalculator
pShippingGroup - the group that should be inspected for a value which falls between configured range values.
Returns:
the sum of all the Number values fetched from the configured property
Throws:
PricingException - if there was a problem discovering the range comparison value