Display current task within a process instance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2012 11:06 AM
Is there any way to display the process diagram AND show which task the user is currently on. I have seen mention of the ProcessDiagramImageGenerator API but cannot find anything that shows the way to show the current task
Any help would be very much appreciated
Many thanks
Mike
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2012 02:53 AM
public static InputStream generateDiagram(ProcessDefinitionEntity processDefinition, String imageType, List<String> highLightedActivities) {
Example usage in activiti-explorer code:
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processInstance
.getProcessDefinitionId());
if (processDefinition != null && processDefinition.isGraphicalNotationDefined()) {
InputStream definitionImageStream = ProcessDiagramGenerator.generateDiagram(processDefinition, "png",
runtimeService.getActiveActivityIds(processInstance.getId()));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2016 09:17 AM
Can we export the active task diagram
ie. i have a large process diagram, so don't want to export the whole diagram, instead i wish if it is possible to export the cropped digram that shows only active task with surrounding tasks only…
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2012 10:09 AM
When I attempt to run this code…
ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
RuntimeService runtimeService = processEngine.getRuntimeService();
RepositoryService repositoryService = processEngine.getRepositoryService();
ProcessDefinitionQuery processDefQ = repositoryService.createProcessDefinitionQuery().processDefinitionKey("ProcessDEADLINE");
System.out.println("Count: " + processDefQ.count());
for(ProcessDefinition p: processDefQ.list()){
if(p.getVersion() == processDefQ.count()){
ProcessInstance pi = runtimeService.createProcessInstanceQuery().processDefinitionId(p.getId()).singleResult();
InputStream is = ProcessDiagramGenerator.generateDiagram((ProcessDefinitionEntity) p, "png", runtimeService.getActiveActivityIds(pi.getId()));
OutputStream out = new FileOutputStream(new File("C:\\Mike data\\Diagram.png"));
int read = 0;
byte[] bytes = new byte[1024];
while ((read = is.read(bytes)) != -1) {
out.write(bytes, 0, read);
}
is.close();
out.flush();
out.close();
}
}
I get the following error…
Exception in thread "main" java.awt.image.RasterFormatException: (x + width) is outside raster
at sun.awt.image.IntegerInterleavedRaster.createWritableChild(IntegerInterleavedRaster.java:450)
at java.awt.image.BufferedImage.getSubimage(BufferedImage.java:1156)
at org.activiti.engine.impl.bpmn.diagram.ProcessDiagramCanvas.generateImage(ProcessDiagramCanvas.java:166)
at org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator.generateDiagram(ProcessDiagramGenerator.java:236)
at org.iop.production.ProcessDiagramImageGenerator.main(ProcessDiagramImageGenerator.java:38)
I have checked my XML file (created via the Eclipse plugin) and it appears that all elements have a name and x and y co-ordinates and the XML has all the DI information
What am I doing wrong?
Many thanks
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2012 10:16 AM
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processInstance
.getProcessDefinitionId());
Using the query to obtain a processDefinition doesn't initialize in internal activity-structure, rather it's just a entity representing database-row…

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 03:12 AM
how I can set variable processInstance? ProcessInstance processInstance = ???

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2012 10:42 AM
That is absolutely superb!!!! Works like a dream
(I was trying to also find my way round the Engine API and whole relationships so I seemed to just cherry pick the bits I thought I needed from your code! Won't make that mistake again!)
Many many thanks
Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2013 05:35 AM
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processInstance
.getProcessDefinitionId());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2013 06:56 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2013 08:09 AM
immediate answer, i suppose that eclipse has a bad day and doesn't make suggestions. When i import the class you wrote the problem was solved.
