cancel
Showing results for 
Search instead for 
Did you mean: 

Track the process like JBPM4

weiyi2011
Champ in-the-making
Champ in-the-making
Hi, everybody.

I want to track the process like JBPM4.

JBPM4:

// get ID from jsp page
String id = ActionUtil.getParameter("piId");
      
ProcessEngine pe = Configuration.getProcessEngine();
RepositoryService ps = pe.getRepositoryService();
ExecutionService es = pe.getExecutionService();
      
// query the process instance
ProcessInstance pi = es.createProcessInstanceQuery().processInstanceId(id).uniqueResult();
String pdId = pi.getProcessDefinitionId();
Set<String> names = pi.findActiveActivityNames();
      
// get the coordinate of acitivity
ActivityCoordinates ac =  ps.getActivityCoordinates(pdId,names.iterator().next());
System.out.println(ac.getX() +"\t" +ac.getY());


Activiti5:[something I try]   :cry:

ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
            .processDefinitionKey("leave2")
            .list()
            .get(0);
      
ProcessDefinitionImpl pdImpl = (ProcessDefinitionImpl) processDefinition;
/**
* ??? ProcessDefinitionImpl.getInitial is null
*/
ActivityImpl actImpl = pdImpl.getInitial();
System.out.println(actImpl.getX() +"\t" +actImpl.getY());
      
ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery()
             .executionId("101")
             .singleResult();

/**
* ??? execution.getActivity() is null
*/
actImpl = execution.getActivity();
System.out.println(actImpl.getX() +"\t" +actImpl.getY());

Can you show me the way? Thanks very much.
10 REPLIES 10

weiyi2011
Champ in-the-making
Champ in-the-making
Which version are you using? DI information was added in the last (5.2) release.

Could you please upload your process so we can take a look?

Hi, jbarrez.

Yes. I use activiti5.1. And I create a new activiti by version 5.2, It work well.

Thanks very much.    Smiley Very Happy