07-16-2012 11:06 AM
07-17-2012 02:53 AM
public static InputStream generateDiagram(ProcessDefinitionEntity processDefinition, String imageType, List<String> highLightedActivities) {
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processInstance
.getProcessDefinitionId());
if (processDefinition != null && processDefinition.isGraphicalNotationDefined()) {
InputStream definitionImageStream = ProcessDiagramGenerator.generateDiagram(processDefinition, "png",
runtimeService.getActiveActivityIds(processInstance.getId()));
05-19-2016 09:17 AM
07-17-2012 10:09 AM
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();
}
}
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)
07-17-2012 10:16 AM
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processInstance
.getProcessDefinitionId());
02-21-2019 03:12 AM
how I can set variable processInstance? ProcessInstance processInstance = ???
07-17-2012 10:42 AM
03-28-2013 05:35 AM
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processInstance
.getProcessDefinitionId());
03-28-2013 06:56 AM
03-28-2013 08:09 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.