/**
  * Private method used by applyAllItemOffers to create an OrderItemAdjustment from a
  * CandidateItemOffer and associates the OrderItemAdjustment to the OrderItem.
  *
  * @param itemOffer a CandidateItemOffer to apply to an OrderItem
  */
 protected void applyOrderItemAdjustment(
     PromotableCandidateItemOffer itemOffer, PromotableOrderItem orderItem) {
   OrderItemAdjustment itemAdjustment = offerDao.createOrderItemAdjustment();
   itemAdjustment.init(
       orderItem.getDelegate(), itemOffer.getOffer(), itemOffer.getOffer().getName());
   // add to adjustment
   PromotableOrderItemAdjustment promotableOrderItemAdjustment =
       promotableItemFactory.createPromotableOrderItemAdjustment(itemAdjustment, orderItem);
   orderItem.addOrderItemAdjustment(
       promotableOrderItemAdjustment); // This is how we can tell if an item has been discounted
 }
 public void resetTotalitarianOfferApplied() {
   totalitarianOfferApplied = false;
   notCombinableOfferAppliedAtAnyLevel = false;
   for (OrderAdjustment adjustment : delegate.getOrderAdjustments()) {
     if (adjustment.getOffer().isTotalitarianOffer() != null
         && adjustment.getOffer().isTotalitarianOffer()) {
       totalitarianOfferApplied = true;
       break;
     }
     if (!adjustment.getOffer().isCombinableWithOtherOffers()) {
       notCombinableOfferAppliedAtAnyLevel = true;
       break;
     }
   }
   if (!totalitarianOfferApplied || !notCombinableOfferAppliedAtAnyLevel) {
     check:
     {
       for (OrderItem orderItem : delegate.getOrderItems()) {
         for (OrderItemAdjustment adjustment : orderItem.getOrderItemAdjustments()) {
           if (adjustment.getOffer().isTotalitarianOffer() != null
               && adjustment.getOffer().isTotalitarianOffer()) {
             totalitarianOfferApplied = true;
             break check;
           }
           if (!adjustment.getOffer().isCombinableWithOtherOffers()) {
             notCombinableOfferAppliedAtAnyLevel = true;
             break check;
           }
         }
       }
     }
   }
   if (!totalitarianOfferApplied || !notCombinableOfferAppliedAtAnyLevel) {
     check:
     {
       for (FulfillmentGroup fg : delegate.getFulfillmentGroups()) {
         for (FulfillmentGroupAdjustment adjustment : fg.getFulfillmentGroupAdjustments()) {
           if (adjustment.getOffer().isTotalitarianOffer() != null
               && adjustment.getOffer().isTotalitarianOffer()) {
             totalitarianOfferApplied = true;
             break check;
           }
           if (!adjustment.getOffer().isCombinableWithOtherOffers()) {
             notCombinableOfferAppliedAtAnyLevel = true;
             break check;
           }
         }
       }
     }
   }
 }