@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 void shipConsignment(final ConsignmentModel consignment) {
   if (consignment == null) {
     LOG.error("No consignment to ship");
   } else {
     if (consignment.getDeliveryMode() instanceof PickUpDeliveryModeModel) {
       consignment.setStatus(ConsignmentStatus.READY_FOR_PICKUP);
     } else {
       consignment.setStatus(ConsignmentStatus.SHIPPED);
     }
     consignment.setShippingDate(getTimeService().getCurrentTime());
     for (final ConsignmentEntryModel entry : consignment.getConsignmentEntries()) {
       entry.setShippedQuantity(entry.getOrderEntry().getQuantity());
       getModelService().save(entry);
     }
     getModelService().save(consignment);
     if (LOG.isInfoEnabled()) {
       LOG.info("Consignment [" + consignment.getCode() + "] shipped");
     }
   }
 }
  @Override
  public void prepareConsignment(final ConsignmentModel consignment) {
    for (final ConsignmentEntryModel consignmentEntries : consignment.getConsignmentEntries()) {
      consignmentEntries.setShippedQuantity(consignmentEntries.getQuantity());
    }
    consignment.setStatus(ConsignmentStatus.READY);
    getModelService().save(consignment);

    final Thread warehouse =
        new Thread(
            new Warehouse(
                Registry.getCurrentTenant().getTenantID(), consignment.getPk().getLongValue()));
    warehouse.start();

    try {
      Thread.sleep(3000);
    } catch (final InterruptedException e) {
      // nothing to do
    }
  }