protected void abortProcessInstances(KieSession ksession) { if (sessionPersistence) { try { logService.findActiveProcessInstances().forEach(pi -> ksession.abortProcessInstance(pi.getId())); } catch(Exception e) { } } }
public List<ProcessInstanceRef> getProcessInstances(String definitionId) { List<ProcessInstanceLog> processInstances = CommandDelegate.getActiveProcessInstanceLogsByProcessId(definitionId); List<ProcessInstanceRef> result = new ArrayList<ProcessInstanceRef>(); for (ProcessInstanceLog processInstance: processInstances) { Collection<NodeInstance> activeNodes = CommandDelegate.getActiveNodeInstances(processInstance.getId()); result.add(Transform.processInstance(processInstance, activeNodes)); } return result; }
public ProcessInstanceRef newInstance(String definitionId) { ProcessInstanceLog processInstance = CommandDelegate.startProcess(definitionId, null); Collection<NodeInstance> activeNodes = CommandDelegate.getActiveNodeInstances(processInstance.getId()); return Transform.processInstance(processInstance, activeNodes); }
public ProcessInstanceRef getProcessInstance(String instanceId) { ProcessInstanceLog processInstance = CommandDelegate.getProcessInstanceLog(instanceId); Collection<NodeInstance> activeNodes = CommandDelegate.getActiveNodeInstances(processInstance.getId()); return Transform.processInstance(processInstance, activeNodes); }
public ProcessInstanceRef newInstance(String definitionId, Map<String, Object> processVars) { ProcessInstanceLog processInstance = CommandDelegate.startProcess(definitionId, processVars); Collection<NodeInstance> activeNodes = CommandDelegate.getActiveNodeInstances(processInstance.getId()); return Transform.processInstance(processInstance, activeNodes); }
protected void abortProcessInstances(KieSession ksession) { if (sessionPersistence) { try { logService.findActiveProcessInstances().forEach(pi -> ksession.abortProcessInstance(pi.getId())); } catch(Exception e) { } } }
@Test public void testSetProcessInstanceVariables(){ ProcessInstanceLog instance = CommandDelegate.startProcess("UserTask", null); HashMap<String,Object> newVariables = new HashMap<String, Object>(); newVariables.put("key", "value2"); CommandDelegate.setProcessInstanceVariables(instance.getId() + "", newVariables); assertEquals(newVariables, CommandDelegate.getProcessInstanceVariables(instance.getId() + "")); }
@Test public void testNewInstance() throws Exception { StatefulKnowledgeSession session = StatefulKnowledgeSessionUtil.getStatefulKnowledgeSession(); Map<String, Object> params = new HashMap<String, Object>(); params.put("employee", "krisv"); params.put("reason", "Yearly performance evaluation"); String definitionId = "Evaluation"; ProcessInstanceLog processInstance = CommandDelegate.startProcess(definitionId, params); Collection<NodeInstance> activeNodes = CommandDelegate.getActiveNodeInstances(processInstance.getId()); assertNotNull(activeNodes); Transform.processInstance(processInstance, activeNodes); } }