atg.commerce.pricing
Class PropertyAggregator

java.lang.Object
  extended by atg.commerce.pricing.Aggregator
      extended by atg.commerce.pricing.PropertyAggregator
Direct Known Subclasses:
QuantityAggregator

public class PropertyAggregator
extends Aggregator

An implementation of the Aggregator class. PropertyAggregator is a generic aggregator that allows any numeric property to be aggregated. The name of the property to be aggregated should be retrieved from the attributes map and resolved accordingly into a value. From here, aggregation can take place.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
PropertyAggregator()
           
 
Method Summary
protected  AggregatorInfo calculate(java.lang.String pOperation, java.lang.Double pAggValueSoFar, java.lang.Long pQuantityMatched, java.lang.Double pTargetValue, CommerceItem pItem, java.util.Map pAttributes)
          This method will calculate (based on the given operation) an aggregated value using pItem.
 java.lang.Number parseValue(java.lang.String pValue, java.lang.Class<?> pType)
          Parses a string value and returns a Number representation.
 
Methods inherited from class atg.commerce.pricing.Aggregator
getOperations, getOverrideProperty, isValidOperation, setOperations, setOverrideProperty
 
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

PropertyAggregator

public PropertyAggregator()
Method Detail

calculate

protected AggregatorInfo calculate(java.lang.String pOperation,
                                   java.lang.Double pAggValueSoFar,
                                   java.lang.Long pQuantityMatched,
                                   java.lang.Double pTargetValue,
                                   CommerceItem pItem,
                                   java.util.Map pAttributes)
                            throws PricingException
This method will calculate (based on the given operation) an aggregated value using pItem.

Parameters:
pOperation - the operation to invoke on the aggregator
pAggValueSoFar - the aggregated value so far, which may be potentially derived from many calculations from multiple items
pQuantityMatched - the number of items that have contributed to the aggregated value
pTargetValue - a value specified in the condition/offer of a promotion which can be used as a target in relation to the aggregated value. May or may not be relevant to an aggregator
pItem - the item that is currently being evaluated
pAttributes - extra parameters
Returns:
holds amended aggValueSoFar and quantityMatched values
Throws:
PricingException

parseValue

public java.lang.Number parseValue(java.lang.String pValue,
                                   java.lang.Class<?> pType)
                            throws java.lang.NumberFormatException
Parses a string value and returns a Number representation.

Parameters:
pValue - value to be parsed
pType - class type of pValue
Returns:
parsed value
Throws:
java.lang.NumberFormatException - if pValue could not be parsed