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

frederikherema1
Star Contributor
Star Contributor
The ProcessDefinition returned by the query had no ActivityImpl initialized, use this (not exposed on public API) instead:

ReadOnlyProcessDefinition def = ((RepositoryServiceImpl)repoService).getDeployedProcessDefinition(processDefinitionId);

frederikherema1
Star Contributor
Star Contributor
Also, Activiti offers the process-instance visualisation in activiti Probe, or through the REST-API:

http://www.jorambarrez.be/blog/2011/02/01/screencast-proc-inst-visual/
or org.activiti.engine.impl.bpmn.diagram.ProcessDiagramCanvas

weiyi2011
Champ in-the-making
Champ in-the-making
The ProcessDefinition returned by the query had no ActivityImpl initialized, use this (not exposed on public API) instead:

ReadOnlyProcessDefinition def = ((RepositoryServiceImpl)repoService).getDeployedProcessDefinition(processDefinitionId);

I try these code. But I found all of them return the value is -1.

What's the matter? Why all coordinates is -1?

weiyi2011
Champ in-the-making
Champ in-the-making

// Graphical information
protected int x = -1;
protected int y = -1;
protected int width = -1;
protected int height = -1;

this is init value, but I want to get the coordinate the same as XXX.activiti.

Thanks again.

jbarrez
Star Contributor
Star Contributor
These values are filled in during parsing, IF your process has Diagram interchange information (eg. when using Activiti Modeler or Designer)

weiyi2011
Champ in-the-making
Champ in-the-making
These values are filled in during parsing, IF your process has Diagram interchange information (eg. when using Activiti Modeler or Designer)

Hi, jbarrez.

I haven't got your point.  Can you explain more particularer?

Show me some java CODE.

Thanks a lot.

jbarrez
Star Contributor
Star Contributor
See http://activiti.org/userguide/index.html#generatingProcessDiagram

Your process must contain informations such as <bpmndi:BPMNShape … etc. Those will automatically be produced by the modeler and designer.

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

I design my process by eclipse Designer and not signavio.

http://activiti.org/userguide/index.html#generatingProcessDiagram
In case no image is provided in the deployment, as described in the previous section, the Activiti engine will generate a diagram image when the process definition contains the necessary 'diagram interchange' information. This is the case when using the Activiti Modeler (and in the near future when using the Activiti Eclipse Designer).

jbarrez
Star Contributor
Star Contributor
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?