use of org.activiti.bpmn.model.BpmnModel in project Activiti by Activiti.
the class StartEventConverterTest method connvertJsonToModel.
@Test
public void connvertJsonToModel() throws Exception {
BpmnModel bpmnModel = readJsonFile();
validateModel(bpmnModel);
}
use of org.activiti.bpmn.model.BpmnModel in project Activiti by Activiti.
the class SubProcessConverterTest method connvertJsonToModel.
@Test
public void connvertJsonToModel() throws Exception {
BpmnModel bpmnModel = readJsonFile();
validateModel(bpmnModel);
}
use of org.activiti.bpmn.model.BpmnModel in project Activiti by Activiti.
the class UserTaskConverterTest method connvertJsonToModel.
@Test
public void connvertJsonToModel() throws Exception {
BpmnModel bpmnModel = readJsonFile();
validateModel(bpmnModel);
}
use of org.activiti.bpmn.model.BpmnModel in project Activiti by Activiti.
the class ProcessDefinitionImageStreamResourceBuilder method buildStreamResource.
public StreamResource buildStreamResource(ProcessInstance processInstance, RepositoryService repositoryService, RuntimeService runtimeService, ProcessDiagramGenerator diagramGenerator, ProcessEngineConfiguration processEngineConfig) {
StreamResource imageResource = null;
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
if (processDefinition != null && processDefinition.isGraphicalNotationDefined()) {
try {
BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
InputStream definitionImageStream = diagramGenerator.generateDiagram(bpmnModel, "png", runtimeService.getActiveActivityIds(processInstance.getId()), Collections.<String>emptyList(), processEngineConfig.getActivityFontName(), processEngineConfig.getLabelFontName(), processEngineConfig.getAnnotationFontName(), processEngineConfig.getClassLoader(), 1.0);
if (definitionImageStream != null) {
StreamSource streamSource = new InputStreamStreamSource(definitionImageStream);
// Create image name
String imageExtension = extractImageExtension(processDefinition.getDiagramResourceName());
String fileName = processInstance.getId() + UUID.randomUUID() + "." + imageExtension;
imageResource = new StreamResource(streamSource, fileName, ExplorerApp.get());
}
} catch (Throwable t) {
// Image can't be generated, ignore this
LOGGER.warn("Process image cannot be generated due to exception: {} - {}", t.getClass().getName(), t.getMessage());
}
}
return imageResource;
}
use of org.activiti.bpmn.model.BpmnModel in project Activiti by Activiti.
the class ProcessDefinitionImageStreamResourceBuilder method buildStreamResource.
public StreamResource buildStreamResource(String processInstanceId, String processDefinitionId, RepositoryService repositoryService, RuntimeService runtimeService, ProcessDiagramGenerator diagramGenerator, ProcessEngineConfiguration processEngineConfig) {
StreamResource imageResource = null;
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinitionId);
if (processDefinition != null && processDefinition.isGraphicalNotationDefined()) {
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
InputStream definitionImageStream = diagramGenerator.generateDiagram(bpmnModel, "png", runtimeService.getActiveActivityIds(processInstanceId), Collections.<String>emptyList(), processEngineConfig.getActivityFontName(), processEngineConfig.getLabelFontName(), processEngineConfig.getAnnotationFontName(), processEngineConfig.getClassLoader(), 1.0);
StreamSource streamSource = new InputStreamStreamSource(definitionImageStream);
// Create image name
String imageExtension = extractImageExtension(processDefinition.getDiagramResourceName());
String fileName = processInstanceId + UUID.randomUUID() + "." + imageExtension;
imageResource = new StreamResource(streamSource, fileName, ExplorerApp.get());
}
return imageResource;
}
Aggregations