Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * #%L
   * BroadleafCommerce Framework
   * %%
   * Copyright (C) 2009 - 2013 Broadleaf Commerce
   * %%
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  * 
  *       http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * #L%
  */
 package org.broadleafcommerce.core.offer.service.discount;
 
 
Records the usage of this item as qualifier or target of the promotion. The discount amount will be 0 if this item was only used as a qualifier.

Author(s):
jfischer
 
 public class PromotionQualifier implements Serializable
     private static final long serialVersionUID = 1L;
     
     private Offer promotion;
     private OfferItemCriteria itemCriteria;
     private int quantity;
     private int finalizedQuantity;
     
     public Offer getPromotion() {
         return ;
     }
     public void setPromotion(Offer promotion) {
         this. = promotion;
     }
     public OfferItemCriteria getItemCriteria() {
         return ;
     }
     public void setItemCriteria(OfferItemCriteria itemCriteria) {
         this. = itemCriteria;
     }
     public int getQuantity() {
         return ;
     }
     public void setQuantity(int quantity) {
         this. = quantity;
     }
     public int getFinalizedQuantity() {
         return ;
     }
     public void setFinalizedQuantity(int finalizedQuantity) {
         this. = finalizedQuantity;
     }
     
     public void incrementQuantity(int quantity) {
         this. = this. + quantity;
     }
     
     public PromotionQualifier copy() {
         PromotionQualifier pq = new PromotionQualifier();
         pq.setItemCriteria();
         pq.setPromotion();
         pq.setQuantity();
         return pq;
     }
     
     public void resetQty(int qty) {
          = qty;
          = qty;
     }
 
     public PromotionQualifier split(int splitItemQty) {
         PromotionQualifier returnQualifier = copy();
         int newQty =  - splitItemQty;
 
         if (newQty <= 0) {
             throw new IllegalArgumentException("Splitting PromotionQualifier resulted in a negative quantity");
         }
 
         setFinalizedQuantity(newQty);
         setQuantity(newQty);
 
         returnQualifier.setQuantity(splitItemQty);
         returnQualifier.setFinalizedQuantity(splitItemQty);
 
         return returnQualifier;
    }
    public boolean isFinalized() {
        return  == ;
    }
New to GrepCode? Check out our FAQ X