@Produces @Named("orderEntity") @PersistentOrder public Order getOrderEntity() { Order o = entityManager.find(Order.class, businessProcess.getVariable("orderId")); return o; }
public OrderEntity getOrderEntity() { if (orderEntity == null) { // Load the order entity from the database if not already cached orderEntity = orderBusinessLogic.getOrder((Long) businessProcess.getVariable("orderId")); } return orderEntity; }
/** Alternative to do a "businessProcess.startProcessByKey('OrderConfirmation')" in JSF */ @StartProcess("OrderConfirmation") public void saveNewOrder(Order order) { entityManager.persist(order.getCustomer()); entityManager.persist(order); // flush to get the id generated // entityManager.flush(); businessProcess.setVariable("orderId", order.getId()); }
/** * Gets the ID of the current task. * * @return the task ID */ private String getTaskId() { return businessProcess.getTask().getTaskDefinitionKey(); }
/** * Gets the current BPMN model instance. * * @return the BPMN model instance */ private BpmnModelInstance getModelInstance() { String processDefinitionId = businessProcess.getTask().getProcessDefinitionId(); return repositoryService.getBpmnModelInstance(processDefinitionId); }
/** * Completes the user task and sets value of the variable with <code>variableName</code> to <code> * variableValue</code>. * * @param variableName the name of the variable to set * @param variableValue the value to set the variable to * @throws IOException if the task completion fails */ public void completeTask(String variableName, String variableValue) throws IOException { businessProcess.setVariable(variableName, variableValue); taskForm.completeTask(); }