cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the ProcessDiagram for a particular instance?

giri1
Champ in-the-making
Champ in-the-making
I am creating webapp by referring the jar files of an activiti. Till now i am able to do most of the things and now I need to get the process diagram for a particular instance in webapp. I am able to get the diagram for a process like this.

InputStream imageStream = repositoryService.getProcessDiagram(ProcessDefinitionId);

But is there a way to get the diagram for a particular process instance ?

Thanks.
10 REPLIES 10

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Giri,

what do you mean by diagram for a particular process instance?
  1. you can get process definition from process instance and generate diagram for given process definition.
  2. write something special into process diagram (https://github.com/gro-mar/activiti-crystalball/wiki/Drawing-into-process-diagram, https://github.com/gro-mar/activiti-crystalball/wiki/Getting-started#usecase-1---use-artifical-user-...,
  3. instead of process definition diagram you could use audit trail diagram (https://github.com/gro-mar/activiti-crystalball/wiki/Audit-trail-diagram)
Regards
Martin

giri1
Champ in-the-making
Champ in-the-making
I think you got me correctly..I want to get the diagram which shows the process flow for the particular instance..So you are telling that I need to get the diagram and do other stuff on that, Like you have specified in the second point.

If it is possible can you provide me some more sample's to refer?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Giri,

What exactly are you looking for?
(activiti-crystalball is part of the activiti now. and all code is opensource.)

Regards
Martin

giri1
Champ in-the-making
Champ in-the-making
Hi Martin,

What do u mean by (activiti-crystalball is part of the activiti now. and all code is opensource.)?
You mean that jar files of activiti itself has activiti-crystalball class also or what (I don't get it)..

I need exactly like the last image in this page this https://github.com/gro-mar/activiti-crystalball/wiki/Drawing-into-process-diagram

is it possible to get that kind of image through API or I need to go for activiti-crystalball/ProcessInstanceGenerator.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Giri.

The best samples are on the activiti-crystalball wiki pages and source code (https://github.com/gro-mar/activiti-crystalball) or (https://github.com/Activiti/Activiti)

For this case you have to use generator from crystalball.

Regards
Martin

giri1
Champ in-the-making
Champ in-the-making
Hi Martin,

I am able to get the diagram with source code of generator from crystallball. I have completed most of my requirements with Activiti. But I have doubt, That I am doing it in a correct way or not. If I share what I am doing with you, can suggest me on that?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Giri.

What is your question?

Regards
Martin

giri1
Champ in-the-making
Champ in-the-making
Hi Martin,

I am creating webapp using activiti jar.

This is the way i am accessing activiti API from web app.

<java>      //To get configuration info
  processEngine = ProcessEngines.getDefaultProcessEngine();
  
  RuntimeService runtimeService = AuthenticationServlet.processEngine
    .getRuntimeService();

       //To start new process instance
   runtimeService.startProcessInstanceById(
     id, map).getProcessInstanceId(); 
   TaskService taskService = AuthenticationServlet.processEngine
    .getTaskService();

                //To get the task list for particular user
                taskService.createTaskQuery().taskAssignee(user).list();

   //Get and set the task variables
  taskService.getVariable(taskid,"username").toString();
  taskService.setVariable(taskid, "approval", approvestatus);

  //Completing task
  taskService.complete(taskid);
</java>
I want to make sure that is this the correct way of doing it or will it cause any performance issue?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Giri,
(Your last comment is not connected with the thread topic)
I do not expect any performance issues on the activiti side.

Regards
Martin