protected void synchronizeItemQualifiers(OrderItem orderItem, PromotableOrderItem promotableOrderItem) {
Map<Long, PromotionQualifier> qualifiersMap = buildPromotableQualifiersMap(promotableOrderItem);
Map<Long, OrderItemQualifier> unmatchedQualifiersMap = new HashMap<Long, OrderItemQualifier>();
for (OrderItemQualifier orderItemQualifier : orderItem.getOrderItemQualifiers()) {
PromotionQualifier promotableQualifier = qualifiersMap.remove(orderItemQualifier.getOffer().getId());
if (promotableQualifier != null) {
// Offer was used as a qualifier on previous run. Update quantity if needed.
if (orderItemQualifier.getQuantity() != promotableQualifier.getQuantity()) {
orderItemQualifier.setQuantity(new Long(promotableQualifier.getQuantity()));
}
} else {
unmatchedQualifiersMap.put(orderItemQualifier.getId(), orderItemQualifier);
}
}