[jboss-user] [jBPM] - Re: Get Activity Coordinates

Marcelo Zabalet do-not-reply at jboss.com
Thu Jan 10 10:28:47 EST 2013


Marcelo Zabalet [https://community.jboss.org/people/zabalet] created the discussion

"Re: Get Activity Coordinates"

To view the discussion, visit: https://community.jboss.org/message/790133#790133

--------------------------------------------------------------
Ah, ok, I understand, I thought you was interested on the active nodes of an instance, and I see now you are interested on all nodes of a process definition.
I IMHO I suggest two ways.

One is expose the bpmn file to the front end because this file is a standard and has a lot of sense to use it directly for a RIA. It is relative simple to extract diagram information and parsing it with javascript.

The other way is using the api, this has sense too because this way you have only one authorithy of information in your system and some more control. Moreover, if you need another runtime information, you must go this way.

Here some sample code. I'm not yet using it... take it with care

Somewhere in your code you have surely something like this...

org.drools.builder.KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
org.drools.KnowledgeBase knowledgeBase = builder.newKnowledgeBase();
// add some process definitions
// builder.add(resource, ResourceType.BPMN2);

org.drools.runtime.StatefulKnowledgeSession knowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession(knowledgeBase, null, env);

Then, you can do something like this:

// import org.drools.definition.process.Process
Process process = knowledgeBase.getProcess("the.process.definition.id.you.are.interested.in");

You could find a lot of info inside process object, ie:

// import org.jbpm.workflow.core.impl.NodeImpl
// import org.jbpm.workflow.core.impl.WorkflowProcessImpl
for (NodeImpl nodeImpl : (NodeImpl[]) ((WorkflowProcessImpl) process).getNodes()) {
    node.getMetaData().get("height");
    node.getName();
}
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/790133#790133]

Start a new discussion in jBPM at Community
[https://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/20130110/23bf87c6/attachment-0001.html 


More information about the jboss-user mailing list