[jboss-user] [jBPM] - Re: How can I get a itemDefinition related to a process variable?

Francesco Pietrobelli do-not-reply at jboss.com
Thu Sep 8 11:55:52 EDT 2011


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&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110908/7e0da1b4/attachment.html 


More information about the jboss-user mailing list