protected ReplenishmentProcessModel createReplenishmentProcess() {
   final ReplenishmentProcessModel replenishmentProcessModel =
       modelService.create(ReplenishmentProcessModel.class);
   replenishmentProcessModel.setCartToOrderCronJob(cartToOrderCronJob);
   replenishmentProcessModel.setCode(String.valueOf(System.currentTimeMillis()));
   replenishmentProcessModel.setProcessDefinitionName("replenishmentOrderProcess");
   modelService.save(replenishmentProcessModel);
   return replenishmentProcessModel;
 }
Ejemplo n.º 2
0
 @Override
 public void executeAction(final ReplenishmentProcessModel process) throws Exception {
   final CartToOrderCronJobModel cartToOrderCronJob = process.getCartToOrderCronJob();
   final CartModel cronJobCart = cartToOrderCronJob.getCart();
   getUserService().setCurrentUser(cronJobCart.getUser());
   final CartModel clone =
       getCartService()
           .clone(
               getTypeService().getComposedTypeForClass(CartModel.class),
               getTypeService().getComposedTypeForClass(CartEntryModel.class),
               cronJobCart,
               getGuidKeyGenerator().generate().toString());
   clone.setPaymentAddress(cartToOrderCronJob.getPaymentAddress());
   clone.setDeliveryAddress(cartToOrderCronJob.getDeliveryAddress());
   clone.setPaymentInfo(cartToOrderCronJob.getPaymentInfo());
   clone.setStatus(OrderStatus.CREATED);
   clone.setAllPromotionResults(Collections.EMPTY_SET);
   clone.setPaymentTransactions(Collections.EMPTY_LIST);
   clone.setPermissionResults(Collections.EMPTY_LIST);
   clone.setGuid(getGuidKeyGenerator().generate().toString());
   this.modelService.save(clone);
   processParameterHelper.setProcessParameter(process, "cart", clone);
 }