Francesco Pietrobelli [
http://community.jboss.org/people/francesco.pietrobelli] created
the discussion
"Re: How can I get a itemDefinition related to a process variable?"
To view the discussion, visit:
http://community.jboss.org/message/625564#625564
--------------------------------------------------------------
The only solution i found is parsing the bpmn file in which the process is defined in
follwiong way:
org.jbpm.workflow.instance.WorkflowProcessInstance
currentProcess=(org.jbpm.workflow.instance.WorkflowProcessInstance)ksession.getProcess(processInstanceId);
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document doc = documentBuilder.parse(((org.jbpm.process.core.Process)
currentProcess.getProcess()).getResource().getInputStream());
XPathFactory xFactory = XPathFactory.newInstance();
XPath xPath = xFactory.newXPath();
xPath.setNamespaceContext(new BPMN2Namespaces());
Map<String, String> outMap = currentNode.getHumanTaskNode().getOutMappings();
for (String outParameter : outMap.keySet()) {
XPathExpression xExpr1 =
xPath.compile("//bpmn2:definitions/bpmn2:process/bpmn2:property[@id='"
+ outMap.get(outParameter)
+ "']/@itemSubjectRef");
String itemSubjectRef = xExpr1.evaluate(doc);
XPathExpression xExpr2 =
xPath.compile("//bpmn2:definitions/bpmn2:itemDefinition[@id='"
+ itemSubjectRef + "']/@structureRef");
String structureRef = xExpr2.evaluate(doc);
System.out.println("Type of out parameter named
'"+outParameter+"': "+structureRef);
}
But if same one know a way to do that without parsing bpmn file is very appreciated....
Regards,
Francesco
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/625564#625564]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]