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.domain;
 
 
 
 
     private static final long serialVersionUID = 1L;
 
     protected Money saleAdjustmentValue;
     protected Money retailAdjustmentValue;
     protected Money adjustmentValue;
     protected boolean appliedToSalePrice;
     protected Offer offer;
 
     public PromotableOrderItemPriceDetailAdjustmentImpl(PromotableCandidateItemOffer promotableCandidateItemOffer,
             PromotableOrderItemPriceDetail orderItemPriceDetail) {
         assert (promotableCandidateItemOffer != null);
         assert (orderItemPriceDetail != null);
         this. = promotableCandidateItemOffer;
         this. = orderItemPriceDetail;
         this. = promotableCandidateItemOffer.getOffer();
         computeAdjustmentValues();
     }
 
             PromotableOrderItemPriceDetail orderItemPriceDetail) {
         assert (orderItemPriceDetail != null);
          = itemAdjustment.getValue();
         if (itemAdjustment.isAppliedToSalePrice()) {
              = itemAdjustment.getValue();
             // This will just set to a Money value of zero in the correct currency.
              = itemAdjustment.getRetailPriceValue();
         } else {
              = itemAdjustment.getValue();
             // This will just set to a Money value of zero in the correct currency.
              = itemAdjustment.getSalesPriceValue();
         }
          = itemAdjustment.isAppliedToSalePrice();
          = orderItemPriceDetail;
          = itemAdjustment.getOffer();
     }
 
     /*
      * Calculates the value of the adjustment for both retail and sale prices.   
      * If either adjustment is greater than the item value, it will be set to the
      * currentItemValue (e.g. no adjustment can cause a negative value). 
      */
     protected void computeAdjustmentValues() {
          = new Money(getCurrency());
          = new Money(getCurrency());
 
         Money currentPriceDetailRetailValue = .calculateItemUnitPriceWithAdjustments(false);
         Money currentPriceDetailSalesValue = .calculateItemUnitPriceWithAdjustments(true);
         if (currentPriceDetailSalesValue == null) {
             currentPriceDetailSalesValue = currentPriceDetailRetailValue;
         }
         
         BigDecimal offerUnitValue = PromotableOfferUtility.determineOfferUnitValue();
 
          = PromotableOfferUtility.computeAdjustmentValue(currentPriceDetailRetailValueofferUnitValuethisthis);
                 
         if (.getApplyDiscountToSalePrice() == true) {
              = PromotableOfferUtility.computeAdjustmentValue(currentPriceDetailSalesValueofferUnitValuethisthis);
         }
     }
 
     @Override
     public Money getRetailAdjustmentValue() {
         return ;
     }
 
     @Override
     public Money getSaleAdjustmentValue() {
        return ;
    }
    
    @Override
    public BroadleafCurrency getCurrency() {
    }    
    @Override
        return ;
    }
    @Override
    public Offer getOffer() {
        return ;
    }
    @Override
    public boolean isCombinable() {
        Boolean combinable = .isCombinableWithOtherOffers();
        return (combinable != null && combinable);
    }
    @Override
    public boolean isTotalitarian() {
        Boolean totalitarian = .isTotalitarianOffer();
        return (totalitarian != null && totalitarian.booleanValue());
    }
    @Override
    public Long getOfferId() {
        return .getId();
    }
    @Override
    public Money getAdjustmentValue() {
        return ;
    }
    @Override
    public boolean isAppliedToSalePrice() {
        return ;
    }
    @Override
    public void finalizeAdjustment(boolean useSalePrice) {
         = useSalePrice;
        if (useSalePrice) {
             = ;
        } else {
             = ;
        }
    }
    @Override
        newAdjustment.adjustmentValue = ;
        newAdjustment.saleAdjustmentValue = ;
        newAdjustment.retailAdjustmentValue = ;
        newAdjustment.appliedToSalePrice = ;
        return newAdjustment;
    }
New to GrepCode? Check out our FAQ X