Maciej Swiderski [
https://community.jboss.org/people/swiderski.maciej] created the
discussion
"Re: Couldn't retrieve the node name for the process instance in JBPM 5.4"
To view the discussion, visit:
https://community.jboss.org/message/790055#790055
--------------------------------------------------------------
if you use persistence you should make it as part of transaction and to do so you could
use command like following:
String nodeName = ksession.execute(new GenericCommand<String>() {
public String execute(Context context) {
StatefulKnowledgeSession ksession = ((KnowledgeCommandContext)
context).getStatefulKnowledgesession();
org.jbpm.process.instance.ProcessInstance processInstance =
(org.jbpm.process.instance.ProcessInstance) ksession.getProcessInstance(piId);
return
((org.jbpm.workflow.instance.WorkflowProcessInstance)instance).getNodeInstances().iterator().next().getNodeName());
}
});
Obviously it's simple case you could have a command that does all you need.
if you are looking for a way to get node names of active process instance you can use
history log data for it and then you don't need to have anything else but
processInstanceId, take a look at methods of this
http://docs.jboss.org/jbpm/v5.4/javadocs/org/jbpm/process/audit/JPAProces...
class
HTH
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/790055#790055]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]