-
1. Re: How to get a list of process variable (name and value) from the processInstance object?
swiderski.maciej Aug 16, 2012 7:37 AM (in response to byungwoojun)Try with following code:
VariableScopeInstance variableScope = (VariableScopeInstance) processInstance.getContextInstance(VariableScope.VARIABLE_SCOPE); Map<String, Object> variables = variableScope.getVariables();
just make sure that process instance is of type org.jbpm.process.instance.ProcessInstance
HTH
-
2. Re: How to get a list of process variable (name and value) from the processInstance object?
byungwoojun Aug 16, 2012 8:13 AM (in response to swiderski.maciej)Maciej,
Thank you very much! It worked nicely. Use of the org.jbpm.process.instance.ProcessInstance was the key.
Byung
-
3. Re: How to get a list of process variable (name and value) from the processInstance object?
byungwoojun Aug 24, 2012 12:17 PM (in response to byungwoojun)One more question on this topic...
Using the NodeInstance object, is it possible to retreive its (e.g., service task) input parameters and output parameters (key and value)? There is a getVariable(String), but I need to get all input and output parameters for monitoring purposes.
Thanks,
bwj
-
4. Re: How to get a list of process variable (name and value) from the processInstance object?
byungwoojun Aug 27, 2012 11:03 AM (in response to byungwoojun)1 of 1 people found this helpfulI figured it out myself:
===
org.jbpm.workflow.instance.node.WorkItemNodeInstance wn = (org.jbpm.workflow.instance.node.WorkItemNodeInstance)event.getNodeInstance();
if (wn.getWorkItem() != null) {
for (String key : wiParamList.keySet()) {
System.out.println("param key: " + key.toString());
System.out.println("param value: " + wiParamList.get(key));
}
}
Map<String,Object> wiResultList = wn.getWorkItem().getResults();
if (wiResultList != null ) {
System.out.println("result key: " + key.toString());
System.out.println("result value: " + wiResultList.get(key));
}
}
}