public class BandedDiscountCalculatorHelper extends ApplicationLoggingImpl
Modifier and Type | Class and Description |
---|---|
class |
BandedDiscountCalculatorHelper.Band
Internal class to represent a band in the banded promotion
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ADJUSTER_ATTRIBUTE
PMDL 'adjuster' attribute
|
static java.lang.String |
BAND_ATTRIBUTE
PMDL 'band' attribute
|
static java.lang.String |
BANDING_PROPERTY_ATTRIBUTE
PMDL 'bandingProperty' attribute
|
static java.lang.String |
BANDING_PROPERTY_SCOPE_ATTRIBUTE
PMDL 'bandingPropertyScope' attribute
|
static java.lang.String |
BANDING_PROPERTY_SCOPE_DIPI
PMDL banding property scope - "DetailedItemPriceInfo"
|
static java.lang.String |
BANDING_PROPERTY_SCOPE_QUALIFIED_ITEM
PMDL banding property scope - "QualifiedItem"
|
static java.lang.String |
CLASS_VERSION
Class version string
|
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
BandedDiscountCalculatorHelper()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected double |
calculateBandingValue(java.lang.String pBandingPropertyScope,
java.util.Map<java.lang.String,java.lang.Object> pObjectBindings,
java.util.Collection pQualifiedItems)
Determines the banding value to use.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
createBindings(java.lang.String pBandingProperty,
java.util.Map pExtraParameters)
Method to create an object bindings map with the objects that are required to determine
the banding property value.
|
protected BandedDiscountCalculatorHelper.Band |
determineBand(double pBandingValue,
java.util.List<BandedDiscountCalculatorHelper.Band> pBands)
Determines which band to use based on the banding value.
|
protected java.util.List<BandedDiscountCalculatorHelper.Band> |
determineBands(java.util.List<DiscountDetail> pDetails)
Determines the bands from the discount details and sorts them.
|
double |
getAdjuster(RepositoryItem pPricingModel,
java.util.Collection pQualifiedItems,
java.util.Map pExtraParameters,
java.lang.String pDefaultBandingProperty,
java.lang.String pDefaultBandingPropertyScope)
Determines the amount of adjustment to apply.
|
protected double |
getBandingPropertyValue(java.util.Map<java.lang.String,java.lang.Object> pObjectBindings)
This method resolves the banding property value.
|
CalculatorInfo |
getCalculatorInfo(java.lang.String pCalculatorType)
Provide a CalculatorInfo for the calculator
|
addGlobalLogListeners, addLogListener, getLoggingForVlogging, getLoggingIdentifer, getLoggingIdentifier, getLogListenerCount, getLogListeners, initializeFromServiceEvent, isAutoInitListeners, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, removeLogListener, sendLogEvent, setAutoInitListeners, setLoggingDebug, setLoggingError, setLoggingIdentifier, setLoggingInfo, setLoggingTrace, setLoggingWarning
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public static final java.lang.String CLASS_VERSION
public static final java.lang.String BANDING_PROPERTY_ATTRIBUTE
public static final java.lang.String BANDING_PROPERTY_SCOPE_ATTRIBUTE
public static final java.lang.String BAND_ATTRIBUTE
public static final java.lang.String ADJUSTER_ATTRIBUTE
public static final java.lang.String BANDING_PROPERTY_SCOPE_DIPI
public static final java.lang.String BANDING_PROPERTY_SCOPE_QUALIFIED_ITEM
public BandedDiscountCalculatorHelper()
public double getAdjuster(RepositoryItem pPricingModel, java.util.Collection pQualifiedItems, java.util.Map pExtraParameters, java.lang.String pDefaultBandingProperty, java.lang.String pDefaultBandingPropertyScope) throws PricingException
pPricingModel
- RepositoryItem pricing modelpQualifiedItems
- Collection of QualifiedItem objectspExtraParameters
- Map of optional extra parameters, may be nullpDefaultBandingProperty
- String default banding property to usepDefaultBandingPropertyScope
- String default banding property scope to usePricingException
- if the method fails to get a valid double adjusterprotected java.util.Map<java.lang.String,java.lang.Object> createBindings(java.lang.String pBandingProperty, java.util.Map pExtraParameters) throws PricingException
pBandingProperty
- String banding property namepExtraParameters
- Map of extra parametersPricingException
protected double calculateBandingValue(java.lang.String pBandingPropertyScope, java.util.Map<java.lang.String,java.lang.Object> pObjectBindings, java.util.Collection pQualifiedItems) throws PricingException
pBandingPropertyScope
- String bandingPropertyScope "QualifiedItem",
"DetailedItemPriceInfo" or null.pObjectBindings
- Map of banded property objects to use.pQualifiedItems
- Collection of QualifiedItem objects, can only be null if scope is null.PricingException
- for any problems determining the banding value to use.protected double getBandingPropertyValue(java.util.Map<java.lang.String,java.lang.Object> pObjectBindings) throws PricingException
pObjectBindings
- Map of banding property objects to usePricingException
- if it fails to resolve the property value.protected java.util.List<BandedDiscountCalculatorHelper.Band> determineBands(java.util.List<DiscountDetail> pDetails) throws PricingException
pDetails
- List of DiscountDetail from the discount structurePricingException
- for problems creating the bands, must be at least one band.protected BandedDiscountCalculatorHelper.Band determineBand(double pBandingValue, java.util.List<BandedDiscountCalculatorHelper.Band> pBands)
pBandingValue
- double banding value to match withpBands
- List of Band objects to searchpublic CalculatorInfo getCalculatorInfo(java.lang.String pCalculatorType)
pCalculatorType
- String calculator type to set