public void assertProcessVarExists(ProcessInstance process, String... processVarNames) { WorkflowProcessInstanceImpl instance = (WorkflowProcessInstanceImpl) process; List<String> names = new ArrayList<String>(); for (String nodeName : processVarNames) { names.add(nodeName); } for (String pvar : instance.getVariables().keySet()) { if (names.contains(pvar)) { names.remove(pvar); } } if (!names.isEmpty()) { String s = names.get(0); for (int i = 1; i < names.size(); i++) { s += ", " + names.get(i); } fail("Process Variable(s) do not exist: " + s); } }
this.caseDefinitionName = source.getProcessName(); this.caseStatus = source.getState(); this.variables = ((WorkflowProcessInstanceImpl)source).getVariables(); this.milestones = new ArrayList<>(); this.stages = new ArrayList<>();
when(processInstance.getProcessName()).thenReturn("MyProcess"); when(processInstance.getState()).thenReturn(1); when(processInstance.getVariables()).thenReturn(variables);
@Override public void copyFromSource() { if (this.id != null) { return; } this.compositeId = System.getProperty("org.kie.server.id", "") + "_" + source.getId(); this.containerId = ((WorkflowProcessInstance)source).getDeploymentId(); this.correlationKey = ((WorkflowProcessInstanceImpl)source).getCorrelationKey(); this.date = new Date(); this.id = source.getId(); this.initiator = (String) ((WorkflowProcessInstanceImpl)source).getVariable("initiator"); this.parentId = source.getParentProcessInstanceId(); this.processId = source.getProcessId(); this.processInstanceDescription = ((WorkflowProcessInstanceImpl)source).getDescription(); this.processName = source.getProcessName(); this.processVersion = source.getProcess().getVersion(); this.state = source.getState(); this.variables = ((WorkflowProcessInstanceImpl)source).getVariables(); }
when(processInstance.getProcessName()).thenReturn("MyProcess"); when(processInstance.getState()).thenReturn(1); when(processInstance.getVariables()).thenReturn(variables); when(processInstance.getKnowledgeRuntime()).thenReturn(kruntime);
Map<String, Object> parameters = new HashMap<>(getWorkItem().getParameters()); parameters.putAll(((WorkflowProcessInstanceImpl)processInstance).getVariables()); ((WorkflowProcessInstanceImpl)processInstance).getVariables()); break; default:
private Map<String, Object> getProcessInstanceVariables(ProcessInstance processInstance) { Map<String, Object> processInstanceVariables = new HashMap<String, Object>(); if (processInstance instanceof WorkflowProcessInstanceImpl) { Map<String, Object> var = ((WorkflowProcessInstanceImpl)processInstance).getVariables(); if (var != null) { processInstanceVariables.putAll(var); } } return processInstanceVariables; }
private Map<String, Object> getProcessInstanceVariables(ProcessInstance processInstance) { Map<String, Object> processInstanceVariables = new HashMap<String, Object>(); if (processInstance instanceof WorkflowProcessInstanceImpl) { Map<String, Object> var = ((WorkflowProcessInstanceImpl)processInstance).getVariables(); if (var != null) { processInstanceVariables.putAll(var); } } return processInstanceVariables; }
private Map<String, Object> getProcessInstanceVariables(ProcessInstance processInstance) { Map<String, Object> processInstanceVariables = new HashMap<String, Object>(); if (processInstance instanceof WorkflowProcessInstanceImpl) { Map<String, Object> var = ((WorkflowProcessInstanceImpl)processInstance).getVariables(); if (var != null) { processInstanceVariables.putAll(var); } } return processInstanceVariables; }
public void assertProcessVarExists(ProcessInstance process, String... processVarNames) { WorkflowProcessInstanceImpl instance = (WorkflowProcessInstanceImpl) process; List<String> names = new ArrayList<String>(); for (String nodeName : processVarNames) { names.add(nodeName); } for (String pvar : instance.getVariables().keySet()) { if (names.contains(pvar)) { names.remove(pvar); } } if (!names.isEmpty()) { String s = names.get(0); for (int i = 1; i < names.size(); i++) { s += ", " + names.get(i); } fail("Process Variable(s) do not exist: " + s); } }
public void assertProcessVarExists(ProcessInstance process, String... processVarNames) { WorkflowProcessInstanceImpl instance = (WorkflowProcessInstanceImpl) process; List<String> names = new ArrayList<String>(); for (String nodeName : processVarNames) { names.add(nodeName); } for (String pvar : instance.getVariables().keySet()) { if (names.contains(pvar)) { names.remove(pvar); } } if (!names.isEmpty()) { String s = names.get(0); for (int i = 1; i < names.size(); i++) { s += ", " + names.get(i); } fail("Process Variable(s) do not exist: " + s); } }
/** * This returns the variables associated with the process instance. This is a "read-only" function: modifying * the values of the map will not have any effect on the actual variables associated with the process instance. * @param processInstanceId * @return */ public static Map<String, Object> getProcessInstanceVariables(String processInstanceId) { ProcessInstance processInstance = getSession().getProcessInstance(new Long(processInstanceId)); if (processInstance != null) { Map<String, Object> variables = ((WorkflowProcessInstanceImpl) processInstance).getVariables(); if (variables == null) { return new HashMap<String, Object>(); } // filter out null values Map<String, Object> result = new HashMap<String, Object>(); for (Map.Entry<String, Object> entry: variables.entrySet()) { if (entry.getValue() != null) { result.put(entry.getKey(), entry.getValue()); } } return result; } else { throw new IllegalArgumentException("Could not find process instance " + processInstanceId); } }
public void assertProcessVarExists(ProcessInstance process, String... processVarNames) { WorkflowProcessInstanceImpl instance = (WorkflowProcessInstanceImpl) process; List<String> names = new ArrayList<String>(); for (String nodeName : processVarNames) { names.add(nodeName); } for (String pvar : instance.getVariables().keySet()) { if (names.contains(pvar)) { names.remove(pvar); } } if (!names.isEmpty()) { String s = names.get(0); for (int i = 1; i < names.size(); i++) { s += ", " + names.get(i); } fail("Process Variable(s) do not exist: " + s); } }
this.caseDefinitionName = source.getProcessName(); this.caseStatus = source.getState(); this.variables = ((WorkflowProcessInstanceImpl)source).getVariables(); this.milestones = new ArrayList<>(); this.stages = new ArrayList<>();
@Override public void copyFromSource() { if (this.id != null) { return; } this.compositeId = System.getProperty("org.kie.server.id", "") + "_" + source.getId(); this.containerId = ((WorkflowProcessInstance)source).getDeploymentId(); this.correlationKey = ((WorkflowProcessInstanceImpl)source).getCorrelationKey(); this.date = new Date(); this.id = source.getId(); this.initiator = (String) ((WorkflowProcessInstanceImpl)source).getVariable("initiator"); this.parentId = source.getParentProcessInstanceId(); this.processId = source.getProcessId(); this.processInstanceDescription = ((WorkflowProcessInstanceImpl)source).getDescription(); this.processName = source.getProcessName(); this.processVersion = source.getProcess().getVersion(); this.state = source.getState(); this.variables = ((WorkflowProcessInstanceImpl)source).getVariables(); }
Map<String, Object> parameters = new HashMap<>(getWorkItem().getParameters()); parameters.putAll(((WorkflowProcessInstanceImpl)processInstance).getVariables()); ((WorkflowProcessInstanceImpl)processInstance).getVariables()); break; default: