Search in sources :

Example 1 with PersonalMessage

use of org.broadleafcommerce.core.order.domain.PersonalMessage in project BroadleafCommerce by BroadleafCommerce.

the class LegacyOrderServiceImpl method createDiscreteOrderItemRequest.

protected DiscreteOrderItemRequest createDiscreteOrderItemRequest(DiscreteOrderItem discreteOrderItem) {
    DiscreteOrderItemRequest itemRequest = new DiscreteOrderItemRequest();
    itemRequest.setCategory(discreteOrderItem.getCategory());
    itemRequest.setProduct(discreteOrderItem.getProduct());
    itemRequest.setQuantity(discreteOrderItem.getQuantity());
    itemRequest.setSku(discreteOrderItem.getSku());
    if (discreteOrderItem.getPersonalMessage() != null) {
        PersonalMessage personalMessage = orderItemService.createPersonalMessage();
        try {
            BeanUtils.copyProperties(personalMessage, discreteOrderItem.getPersonalMessage());
            personalMessage.setId(null);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
        itemRequest.setPersonalMessage(personalMessage);
    }
    return itemRequest;
}
Also used : DiscreteOrderItemRequest(org.broadleafcommerce.core.order.service.call.DiscreteOrderItemRequest) PersonalMessage(org.broadleafcommerce.core.order.domain.PersonalMessage) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 PersonalMessage (org.broadleafcommerce.core.order.domain.PersonalMessage)1 DiscreteOrderItemRequest (org.broadleafcommerce.core.order.service.call.DiscreteOrderItemRequest)1