AnsweredAssumed Answered

Track the process like JBPM4

Question asked by weiyi2011 on Feb 22, 2011
Latest reply on Feb 25, 2011 by weiyi2011
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.

Attachments

Outcomes