use of com.salesmanager.shop.model.order.history.PersistableOrderStatusHistory in project shopizer by shopizer-ecommerce.
the class OrderFacadeImpl method createOrderStatus.
@Override
public void createOrderStatus(PersistableOrderStatusHistory status, Long id, MerchantStore store) {
Validate.notNull(status, "OrderStatusHistory must not be null");
Validate.notNull(id, "Order id must not be null");
Validate.notNull(store, "MerchantStore must not be null");
// retrieve original order
Order order = orderService.getOrder(id, store);
if (order == null) {
throw new ResourceNotFoundException("Order with id [" + id + "] does not exist for merchant [" + store.getCode() + "]");
}
try {
OrderStatusHistory history = new OrderStatusHistory();
history.setComments(status.getComments());
history.setDateAdded(DateUtil.getDate(status.getDate()));
history.setOrder(order);
history.setStatus(status.getStatus());
orderService.addOrderStatusHistory(order, history);
} catch (Exception e) {
throw new ServiceRuntimeException("An error occured while converting orderstatushistory", e);
}
}
Aggregations