Interface RAOConsumptionSupport
-
- All Known Implementing Classes:
DefaultRAOConsumptionSupport
public interface RAOConsumptionSupportProvides consumption related functionality to consume, track, and calculate quantity of available items to be consumed
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intadjustStrategyQuantity(java.util.Collection<EntriesSelectionStrategyRPD> selectionStrategyRPDs)Adjusts the quantity fields of EntriesSelectionStrategyRPD such that the maximum possible number of entries will be consumed by the action.intadjustStrategyQuantity(java.util.Collection<EntriesSelectionStrategyRPD> selectionStrategyRPDs, int maxCount)Adjusts the quantity fields of EntriesSelectionStrategyRPD such that the maximum possible number of entries will be consumed by the action.<T extends AbstractRuleActionRAO>
voidconsumeOrderEntries(RuleActionContext context, java.util.Collection<EntriesSelectionStrategyRPD> strategies, T actionRAO)Creates newOrderEntryConusmedRAOs for the given strategies, links them to the givenactionRAOand reduces available quantity of order entry by given quantity for every Order Entry from the set and using quantity fromdiscountedOrderEntryMap.java.util.Set<OrderEntryConsumedRAO>consumeOrderEntries(java.util.Set<OrderEntryRAO> selectedEntries, java.util.Map<java.lang.Integer,java.lang.Integer> selectedEntriesMap, AbstractRuleActionRAO actionRAO)Creates newOrderEntryConusmedRAOs with the given quantity, links it to the givenactionRAOand reduces available quantity of order entry by given quantity for every Order Entry from the set and using quantity fromdiscountedOrderEntryMap.OrderEntryConsumedRAOconsumeOrderEntry(OrderEntryRAO orderEntryRAO, int quantity, AbstractRuleActionRAO actionRAO)Creates a newOrderEntryConusmedRAOthat consumes the given orderEntryRAO with the given quantity and adds the consumed entry to the given actionRAOOrderEntryConsumedRAOconsumeOrderEntry(OrderEntryRAO orderEntryRAO, int quantity, java.math.BigDecimal discountValue, AbstractRuleActionRAO actionRAO)Creates a newOrderEntryConusmedRAOthat consumes the given orderEntryRAO and adds the consumed entry to the given actionRAOOrderEntryConsumedRAOconsumeOrderEntry(OrderEntryRAO orderEntryRAO, AbstractRuleActionRAO actionRAO)Creates a newOrderEntryConusmedRAOthat consumes the given orderEntryRAO and adds the consumed entry to the given actionRAOOrderEntryConsumedRAOcreateOrderEntryConsumedRAO(OrderEntryRAO orderEntryRAO, int quantity, java.math.BigDecimal discountValue)Creates new OrderEntryConsumedRAO for given OrderEntryRAO and with given quantity.intgetConsumableQuantity(OrderEntryRAO orderEntryRao)Calculate the order entry consumable quantityintgetConsumedQuantityForOrderEntry(OrderEntryRAO orderEntryRao)Return consumed quantity for a given order entryjava.util.Map<java.lang.Integer,java.lang.Integer>getEligibleEntryQuantities(java.util.Collection<EntriesSelectionStrategyRPD> selectionStrategyRPDs)java.util.Map<java.lang.Integer,java.lang.Integer>getSelectedOrderEntryQuantities(RuleActionContext context, java.util.Collection<EntriesSelectionStrategyRPD> strategies)Gets Order Entry identifiers (orderEntry.entryNumber) and Unit Quantity To Be Consumed for the Order Entries.java.util.Set<OrderEntryRAO>getSelectedOrderEntryRaos(java.util.Collection<EntriesSelectionStrategyRPD> selectionStrategyRPDs, java.util.Map<java.lang.Integer,java.lang.Integer> selectedOrderEntryMap)Gets Order Entry set to be discounted as a result of bundle processing.booleanhasEnoughQuantity(RuleActionContext context, java.util.Collection<EntriesSelectionStrategyRPD> selectionStrategyRPDs)Checks if allentriesSelectionStrategyRPDshave enough quantity.booleanisConsumptionEnabled()Identifies whether order entry consumption is enabledvoidmergeOrderEntryConsumed(OrderEntryConsumedRAO consumedTarget, OrderEntryConsumedRAO consumedSource)Method merges the properties of two instances ofOrderEntryConsumedRAOif the objects refer to the same order entry number and same rulevoidtrackConsumedProducts(RuleActionContext context)voidupdateActionRAOWithConsumed(AbstractRuleActionRAO actionRAO, OrderEntryConsumedRAO orderEntryConsumedRAO)Adds given OrderEntryConsumedRAO to the AbstractRuleActionRAO.consumedEntries.
-
-
-
Method Detail
-
isConsumptionEnabled
boolean isConsumptionEnabled()
Identifies whether order entry consumption is enabled- Returns:
truein case consumption is enabled,falseotherwise
-
trackConsumedProducts
void trackConsumedProducts(RuleActionContext context)
- Parameters:
context- instance ofRuleActionContext
-
consumeOrderEntry
OrderEntryConsumedRAO consumeOrderEntry(OrderEntryRAO orderEntryRAO, int quantity, java.math.BigDecimal discountValue, AbstractRuleActionRAO actionRAO)
Creates a newOrderEntryConusmedRAOthat consumes the given orderEntryRAO and adds the consumed entry to the given actionRAO- Parameters:
orderEntryRAO- the order entry to consumeactionRAO- the action rao to add the consumed entry toquantity- the quantity to consumediscountValue- the discount this order entry consumption gave- Returns:
- the newly created consumed entry
-
consumeOrderEntry
OrderEntryConsumedRAO consumeOrderEntry(OrderEntryRAO orderEntryRAO, AbstractRuleActionRAO actionRAO)
Creates a newOrderEntryConusmedRAOthat consumes the given orderEntryRAO and adds the consumed entry to the given actionRAO- Parameters:
orderEntryRAO- the order entry to consumeactionRAO- the action rao to add the consumed entry to- Returns:
- the newly created consumed entry
-
consumeOrderEntry
OrderEntryConsumedRAO consumeOrderEntry(OrderEntryRAO orderEntryRAO, int quantity, AbstractRuleActionRAO actionRAO)
Creates a newOrderEntryConusmedRAOthat consumes the given orderEntryRAO with the given quantity and adds the consumed entry to the given actionRAO- Parameters:
orderEntryRAO- the order entry to consumequantity- the quantity to consumeactionRAO- the action rao to add the consumed entry to- Returns:
- the newly created consumed entry
-
consumeOrderEntries
<T extends AbstractRuleActionRAO> void consumeOrderEntries(RuleActionContext context, java.util.Collection<EntriesSelectionStrategyRPD> strategies, T actionRAO)
Creates newOrderEntryConusmedRAOs for the given strategies, links them to the givenactionRAOand reduces available quantity of order entry by given quantity for every Order Entry from the set and using quantity fromdiscountedOrderEntryMap.- Parameters:
context- instance ofRuleActionContextstrategies- the selection strategiesactionRAO- theAbstractRuleActionRAOto add the newly created consumed entries to
-
consumeOrderEntries
java.util.Set<OrderEntryConsumedRAO> consumeOrderEntries(java.util.Set<OrderEntryRAO> selectedEntries, java.util.Map<java.lang.Integer,java.lang.Integer> selectedEntriesMap, AbstractRuleActionRAO actionRAO)
Creates newOrderEntryConusmedRAOs with the given quantity, links it to the givenactionRAOand reduces available quantity of order entry by given quantity for every Order Entry from the set and using quantity fromdiscountedOrderEntryMap.- Parameters:
selectedEntries- Order Entries to be consumedselectedEntriesMap- Map having orderEntry.entryNumber as keys and Unit Quantity To Be Consumed as valuesactionRAO- theAbstractRuleActionRAOto add the newly created consumed entries to
-
getConsumedQuantityForOrderEntry
int getConsumedQuantityForOrderEntry(OrderEntryRAO orderEntryRao)
Return consumed quantity for a given order entry- Parameters:
orderEntryRao- Cart order entry- Returns:
- consumed quantity
-
getSelectedOrderEntryQuantities
java.util.Map<java.lang.Integer,java.lang.Integer> getSelectedOrderEntryQuantities(RuleActionContext context, java.util.Collection<EntriesSelectionStrategyRPD> strategies)
Gets Order Entry identifiers (orderEntry.entryNumber) and Unit Quantity To Be Consumed for the Order Entries.- Parameters:
strategies- list ofEntriesSelectionStrategyRPDto pickup units according to the strategies- Returns:
- Map having orderEntry.entryNumber as keys and Unit Quantity To Be Consumed as values
-
getSelectedOrderEntryRaos
java.util.Set<OrderEntryRAO> getSelectedOrderEntryRaos(java.util.Collection<EntriesSelectionStrategyRPD> selectionStrategyRPDs, java.util.Map<java.lang.Integer,java.lang.Integer> selectedOrderEntryMap)
Gets Order Entry set to be discounted as a result of bundle processing.- Parameters:
selectionStrategyRPDs- list ofEntriesSelectionStrategyRPDto pickup units according to the strategiesselectedOrderEntryMap- Map having orderEntry.entryNumber as keys and Unit Quantity To Be Consumed as values
-
createOrderEntryConsumedRAO
OrderEntryConsumedRAO createOrderEntryConsumedRAO(OrderEntryRAO orderEntryRAO, int quantity, java.math.BigDecimal discountValue)
Creates new OrderEntryConsumedRAO for given OrderEntryRAO and with given quantity.- Parameters:
orderEntryRAO- OrderEntryRAO to create consumed entry forquantity- Consumed quantitydiscountValue- the discount this order entry consumption gave- Returns:
- created OrderEntryConsumedRAO
-
updateActionRAOWithConsumed
void updateActionRAOWithConsumed(AbstractRuleActionRAO actionRAO, OrderEntryConsumedRAO orderEntryConsumedRAO)
Adds given OrderEntryConsumedRAO to the AbstractRuleActionRAO.consumedEntries.- Parameters:
actionRAO- AbstractRuleActionRAO to be updatedorderEntryConsumedRAO- to be added to the AbstractRuleActionRAO
-
mergeOrderEntryConsumed
void mergeOrderEntryConsumed(OrderEntryConsumedRAO consumedTarget, OrderEntryConsumedRAO consumedSource)
Method merges the properties of two instances ofOrderEntryConsumedRAOif the objects refer to the same order entry number and same rule- Parameters:
consumedTarget- where to merge the data toconsumedSource- where to merge the data from
-
hasEnoughQuantity
boolean hasEnoughQuantity(RuleActionContext context, java.util.Collection<EntriesSelectionStrategyRPD> selectionStrategyRPDs)
Checks if allentriesSelectionStrategyRPDshave enough quantity.- Parameters:
selectionStrategyRPDs- List of EntriesSelectionStrategyRPD to check- Returns:
- true if all entries selection strategies have enough quantity. false if at least one doesn't have.
-
getEligibleEntryQuantities
java.util.Map<java.lang.Integer,java.lang.Integer> getEligibleEntryQuantities(java.util.Collection<EntriesSelectionStrategyRPD> selectionStrategyRPDs)
-
adjustStrategyQuantity
int adjustStrategyQuantity(java.util.Collection<EntriesSelectionStrategyRPD> selectionStrategyRPDs)
Adjusts the quantity fields of EntriesSelectionStrategyRPD such that the maximum possible number of entries will be consumed by the action. This is done by finding the highest integer multiple that the strategy.quantity can be multiplied by that there is sufficient quantity in the associated OrderEntryRAO object. This figure is then multiplied by the original quantity of the selection strategy.- Parameters:
selectionStrategyRPDs- list of EntriesSelectionStrategyRPD to be updated- Returns:
- The multiple count used to scale the quantity fields of the strategy objects
-
adjustStrategyQuantity
int adjustStrategyQuantity(java.util.Collection<EntriesSelectionStrategyRPD> selectionStrategyRPDs, int maxCount)
Adjusts the quantity fields of EntriesSelectionStrategyRPD such that the maximum possible number of entries will be consumed by the action. This is done by finding the highest integer multiple that the strategy.quantity can be multiplied by that there is sufficient quantity in the associated OrderEntryRAO object. This figure is then multiplied by the original quantity of the selection strategy.- Parameters:
selectionStrategyRPDs- list of EntriesSelectionStrategyRPD to be updatedmaxCount- when maxCount is greater than 0, this parameter acts as an absolute maximum for the multiple.- Returns:
- The multiple count used to scale the quantity fields of the strategy objects
-
getConsumableQuantity
int getConsumableQuantity(OrderEntryRAO orderEntryRao)
Calculate the order entry consumable quantity- Parameters:
orderEntryRao- instance ofOrderEntryRAO- Returns:
- number of units available for consumption
-
-