@Override protected LanguageModel getEmailLanguage(final ConsignmentProcessModel consignmentProcessModel) { if (consignmentProcessModel.getConsignment().getOrder() instanceof OrderModel) { return ((OrderModel) consignmentProcessModel.getConsignment().getOrder()).getLanguage(); } return null; }
@Override public void init( final ConsignmentProcessModel consignmentProcessModel, final EmailPageModel emailPageModel) { super.init(consignmentProcessModel, emailPageModel); orderCode = consignmentProcessModel.getConsignment().getOrder().getCode(); orderGuid = consignmentProcessModel.getConsignment().getOrder().getGuid(); consignmentData = getConsignmentConverter().convert(consignmentProcessModel.getConsignment()); guest = CustomerType.GUEST.equals(getCustomer(consignmentProcessModel).getType()); }
@Override public void executeAction(final ConsignmentProcessModel process) { getProcess2WarehouseAdapter().prepareConsignment(process.getConsignment()); process.setWaitingForConsignment(true); getModelService().save(process); LOG.info("Setting waitForConsignment to true"); }
@Override public String execute(final ConsignmentProcessModel process) { final ConsignmentModel consignment = process.getConsignment(); if (consignment != null) { consignment.setStatus(ConsignmentStatus.PICKUP_COMPLETE); getModelService().save(consignment); return Transition.OK.toString(); } LOG.error("Process has no consignment"); return Transition.ERROR.toString(); }
@Override public String execute(final ConsignmentProcessModel process) { final ConsignmentModel consignment = process.getConsignment(); if (consignment != null) { try { // Check if the Order is Cancelled if (OrderStatus.CANCELLED.equals(consignment.getOrder().getStatus()) || OrderStatus.CANCELLING.equals(consignment.getOrder().getStatus())) { return Transition.CANCEL.toString(); } else { getProcess2WarehouseAdapter().shipConsignment(process.getConsignment()); if (consignment.getDeliveryMode() instanceof PickUpDeliveryModeModel) { return Transition.PICKUP.toString(); } else { return Transition.DELIVERY.toString(); } } } catch (final Exception e) { return Transition.ERROR.toString(); } } return Transition.ERROR.toString(); }
@Override protected CustomerModel getCustomer(final ConsignmentProcessModel consignmentProcessModel) { return (CustomerModel) consignmentProcessModel.getConsignment().getOrder().getUser(); }
@Override protected BaseSiteModel getSite(final ConsignmentProcessModel consignmentProcessModel) { return consignmentProcessModel.getConsignment().getOrder().getSite(); }