@Override protected boolean shouldHandleEvent(final OrderCancelledEvent event) { final OrderModel order = event.getProcess().getOrder(); ServicesUtil.validateParameterNotNullStandardMessage("event.order", order); final BaseSiteModel site = order.getSite(); ServicesUtil.validateParameterNotNullStandardMessage("event.order.site", site); return SiteChannel.B2C.equals(site.getChannel()); }
@Override protected void onSiteEvent(final OrderCancelledEvent event) { final OrderModel orderModel = event.getProcess().getOrder(); final OrderProcessModel orderProcessModel = (OrderProcessModel) getBusinessProcessService() .createProcess( "sendOrderCancelledEmailProcess-" + orderModel.getCode() + "-" + System.currentTimeMillis(), "sendOrderCancelledEmailProcess"); orderProcessModel.setOrder(orderModel); getModelService().save(orderProcessModel); getBusinessProcessService().startProcess(orderProcessModel); }