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.order.service.call;
 
 
 import java.util.List;
 import java.util.Map;

Only the product and quantity are required to add an item to an order. The category can be inferred from the product's default category. The sku can be inferred from either the passed in attributes as they are compared to the product's options or the sku can be determined from the product's default sku. When adding a bundle using this DTO, you MUST have the org.broadleafcommerce.core.catalog.domain.ProductBundle included in the productId for it to properly instantiate the org.broadleafcommerce.core.order.domain.BundleOrderItem Important Note: To protect against misuse, the org.broadleafcommerce.core.order.service.OrderService's addItemToCart method will blank out any values passed in on this DTO for the overrideSalePrice or overrideRetailPrice. Instead, implementors should call the more explicit addItemWithPriceOverrides.
 
 public class OrderItemRequestDTO {
 
     private Long skuId;
     private Long categoryId;
     private Long productId;
     private Long orderItemId;
     private Integer quantity;
     private Money overrideSalePrice;
     private Money overrideRetailPrice;
     private Map<String,StringitemAttributes = new HashMap<String,String>();
     private Long parentOrderItemId;
     
     public OrderItemRequestDTO() {}
     
     public OrderItemRequestDTO(Long productIdInteger quantity) {
         setProductId(productId);
         setQuantity(quantity);
     }
     
     public OrderItemRequestDTO(Long productIdLong skuIdInteger quantity) {
         setProductId(productId);
         setSkuId(skuId);
         setQuantity(quantity);
     }
     
     public OrderItemRequestDTO(Long productIdLong skuIdLong categoryIdInteger quantity) {
         setProductId(productId);
         setSkuId(skuId);
         setCategoryId(categoryId);
         setQuantity(quantity);
     }
 
     public Long getSkuId() {
         return ;
     }
 
     public OrderItemRequestDTO setSkuId(Long skuId) {
         this. = skuId;
         return this;
     }
 
     public Long getCategoryId() {
         return ;
     }
 
     public OrderItemRequestDTO setCategoryId(Long categoryId) {
         this. = categoryId;
         return this;
     }
 
    public Long getProductId() {
        return ;
    }
    public OrderItemRequestDTO setProductId(Long productId) {
        this. = productId;
        return this;
    }
    public Integer getQuantity() {
        return ;
    }
    public OrderItemRequestDTO setQuantity(Integer quantity) {
        this. = quantity;
        return this;
    }
    public Map<StringStringgetItemAttributes() {
        return ;
    }
    public OrderItemRequestDTO setItemAttributes(Map<StringStringitemAttributes) {
        this. = itemAttributes;
        return this;
    }
    
    public Long getOrderItemId() {
        return ;
    }
    public OrderItemRequestDTO setOrderItemId(Long orderItemId) {
        this. = orderItemId;
        return this;
    }
    public Money getOverrideSalePrice() {
        return ;
    }
    public void setOverrideSalePrice(Money overrideSalePrice) {
        this. = overrideSalePrice;
    }
    public Money getOverrideRetailPrice() {
        return ;
    }
    public void setOverrideRetailPrice(Money overrideRetailPrice) {
        this. = overrideRetailPrice;
    }
        return ;
    }
    
    public void setChildOrderItems(List<OrderItemRequestDTOchildOrderItems) {
        this. = childOrderItems;
    }
    public Long getParentOrderItemId() {
        return ;
    }
    public void setParentOrderItemId(Long parentOrderItemId) {
        this. = parentOrderItemId;
    }
    
New to GrepCode? Check out our FAQ X