@Override
  @Transactional("blTransactionManager")
  public Order addAllItemsFromNamedOrder(Order namedOrder, boolean priceOrder)
      throws RemoveFromCartException, AddToCartException {
    Order cartOrder = orderDao.readCartForCustomer(namedOrder.getCustomer());
    if (cartOrder == null) {
      cartOrder = createNewCartForCustomer(namedOrder.getCustomer());
    }
    List<OrderItem> items = new ArrayList<OrderItem>(namedOrder.getOrderItems());
    for (OrderItem item : items) {
      if (moveNamedOrderItems) {
        removeItem(namedOrder.getId(), item.getId(), false);
      }

      OrderItemRequestDTO orderItemRequest =
          orderItemService.buildOrderItemRequestDTOFromOrderItem(item);
      cartOrder = addItem(cartOrder.getId(), orderItemRequest, priceOrder);
    }

    if (deleteEmptyNamedOrders) {
      cancelOrder(namedOrder);
    }

    return cartOrder;
  }
  @Override
  @Transactional("blTransactionManager")
  public Order addItemFromNamedOrder(
      Order namedOrder, OrderItem item, int quantity, boolean priceOrder)
      throws RemoveFromCartException, AddToCartException, UpdateCartException {
    // Validate that the quantity requested makes sense
    if (quantity < 1 || quantity > item.getQuantity()) {
      throw new IllegalArgumentException("Cannot move 0 or less quantity");
    } else if (quantity == item.getQuantity()) {
      return addItemFromNamedOrder(namedOrder, item, priceOrder);
    }

    Order cartOrder = orderDao.readCartForCustomer(namedOrder.getCustomer());
    if (cartOrder == null) {
      cartOrder = createNewCartForCustomer(namedOrder.getCustomer());
    }

    if (moveNamedOrderItems) {
      // Update the old item to its new quantity only if we're moving items
      OrderItemRequestDTO orderItemRequestDTO = new OrderItemRequestDTO();
      orderItemRequestDTO.setOrderItemId(item.getId());
      orderItemRequestDTO.setQuantity(item.getQuantity() - quantity);
      updateItemQuantity(namedOrder.getId(), orderItemRequestDTO, false);
    }

    OrderItemRequestDTO orderItemRequest =
        orderItemService.buildOrderItemRequestDTOFromOrderItem(item);
    orderItemRequest.setQuantity(quantity);
    cartOrder = addItem(cartOrder.getId(), orderItemRequest, priceOrder);

    return cartOrder;
  }
  @Override
  @Transactional("blTransactionManager")
  public Order createNamedOrderForCustomer(String name, Customer customer) {
    Order namedOrder = orderDao.create();
    namedOrder.setCustomer(customer);
    namedOrder.setName(name);
    namedOrder.setStatus(OrderStatus.NAMED);

    if (extensionManager != null) {
      extensionManager.getProxy().attachAdditionalDataToNewNamedCart(customer, namedOrder);
    }

    if (BroadleafRequestContext.getBroadleafRequestContext() != null) {
      namedOrder.setLocale(BroadleafRequestContext.getBroadleafRequestContext().getLocale());
    }

    return orderDao.save(namedOrder); // No need to price here
  }
 @Override
 @Transactional("blTransactionManager")
 public Order confirmOrder(Order order) {
   return orderDao.submitOrder(order);
 }
 @Override
 @Transactional("blTransactionManager")
 public void deleteOrder(Order order) {
   orderDao.delete(order);
 }
 // This method exists to provide OrderService methods the ability to save an order
 // without having to worry about a PricingException being thrown.
 protected Order persist(Order order) {
   return orderDao.save(order);
 }
 @Override
 public Order findOrderByOrderNumber(String orderNumber) {
   return orderDao.readOrderByOrderNumber(orderNumber);
 }
 @Override
 public List<Order> findOrdersForCustomer(Customer customer, OrderStatus status) {
   return orderDao.readOrdersForCustomer(customer, status);
 }
 @Override
 public List<Order> findOrdersForCustomer(Customer customer) {
   return orderDao.readOrdersForCustomer(customer.getId());
 }
 @Override
 public Order findCartForCustomer(Customer customer) {
   return orderDao.readCartForCustomer(customer);
 }
 @Override
 public Order findOrderById(Long orderId) {
   return orderDao.readOrderById(orderId);
 }
 @Override
 public Order findNamedOrderForCustomer(String name, Customer customer) {
   return orderDao.readNamedOrderForCustomer(customer, name);
 }
 @Override
 @Transactional("blTransactionManager")
 public Order createNewCartForCustomer(Customer customer) {
   return orderDao.createNewCartForCustomer(customer);
 }