public BigDecimal getPromoQuantityCandidateUseActionAndAllConds(GenericValue productPromoAction) {
BigDecimal totalUse = BigDecimal.ZERO;
String productPromoId = productPromoAction.getString("productPromoId");
String productPromoRuleId = productPromoAction.getString("productPromoRuleId");
GenericPK productPromoActionPK = productPromoAction.getPrimaryKey();
BigDecimal existingValue = (BigDecimal) this.quantityUsedPerPromoCandidate.get(productPromoActionPK);
if (existingValue != null) {
totalUse = existingValue;
}
Iterator entryIter = this.quantityUsedPerPromoCandidate.entrySet().iterator();
while (entryIter.hasNext()) {
Map.Entry entry = (Map.Entry) entryIter.next();
GenericPK productPromoCondActionPK = (GenericPK) entry.getKey();
BigDecimal quantityUsed = (BigDecimal) entry.getValue();
if (quantityUsed != null) {
// must be in the same rule and be a condition
if (productPromoId.equals(productPromoCondActionPK.getString("productPromoId")) &&
productPromoRuleId.equals(productPromoCondActionPK.getString("productPromoRuleId")) &&
productPromoCondActionPK.containsKey("productPromoCondSeqId")) {
totalUse = totalUse.add(quantityUsed);
}
}
}