use of org.activiti.bpmn.model.Process in project Activiti by Activiti.
the class BpmnAutoLayout method execute.
public void execute() {
// Reset any previous DI information
bpmnModel.getLocationMap().clear();
bpmnModel.getFlowLocationMap().clear();
// Generate DI for each process
for (Process process : bpmnModel.getProcesses()) {
layout(process);
// Operations that can only be done after all elements have received DI
translateNestedSubprocesses(process);
}
}
use of org.activiti.bpmn.model.Process in project Activiti by Activiti.
the class LaneExtensionTest method testLaneExtensionElement.
@Test
@Deployment
public void testLaneExtensionElement() {
ProcessDefinition processDefinition = activitiRule.getRepositoryService().createProcessDefinitionQuery().processDefinitionKey("swimlane-extension").singleResult();
BpmnModel bpmnModel = activitiRule.getRepositoryService().getBpmnModel(processDefinition.getId());
byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);
System.out.println(new String(xml));
Process bpmnProcess = bpmnModel.getMainProcess();
for (Lane l : bpmnProcess.getLanes()) {
Map<String, List<ExtensionElement>> extensions = l.getExtensionElements();
Assert.assertTrue(extensions.size() > 0);
}
}
use of org.activiti.bpmn.model.Process in project Activiti by Activiti.
the class DefaultProcessDiagramGenerator method generateProcessDiagram.
protected DefaultProcessDiagramCanvas generateProcessDiagram(BpmnModel bpmnModel, String imageType, List<String> highLightedActivities, List<String> highLightedFlows, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader, double scaleFactor) {
prepareBpmnModel(bpmnModel);
DefaultProcessDiagramCanvas processDiagramCanvas = initProcessDiagramCanvas(bpmnModel, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader);
// Draw pool shape, if process is participant in collaboration
for (Pool pool : bpmnModel.getPools()) {
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(pool.getId());
processDiagramCanvas.drawPoolOrLane(pool.getName(), graphicInfo);
}
// Draw lanes
for (Process process : bpmnModel.getProcesses()) {
for (Lane lane : process.getLanes()) {
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(lane.getId());
processDiagramCanvas.drawPoolOrLane(lane.getName(), graphicInfo);
}
}
// Draw activities and their sequence-flows
for (Process process : bpmnModel.getProcesses()) {
for (FlowNode flowNode : process.findFlowElementsOfType(FlowNode.class)) {
drawActivity(processDiagramCanvas, bpmnModel, flowNode, highLightedActivities, highLightedFlows, scaleFactor);
}
}
// Draw artifacts
for (Process process : bpmnModel.getProcesses()) {
for (Artifact artifact : process.getArtifacts()) {
drawArtifact(processDiagramCanvas, bpmnModel, artifact);
}
List<SubProcess> subProcesses = process.findFlowElementsOfType(SubProcess.class, true);
if (subProcesses != null) {
for (SubProcess subProcess : subProcesses) {
for (Artifact subProcessArtifact : subProcess.getArtifacts()) {
drawArtifact(processDiagramCanvas, bpmnModel, subProcessArtifact);
}
}
}
}
return processDiagramCanvas;
}
use of org.activiti.bpmn.model.Process in project Activiti by Activiti.
the class WorkflowDefinitionConversionTest method testTaskListenerForOutgoingProperties.
@Test
public void testTaskListenerForOutgoingProperties() throws Exception {
WorkflowDefinition definition = new WorkflowDefinition();
definition.setId("process");
HumanStepDefinition humanStep = new HumanStepDefinition();
humanStep.setId("step1");
FormDefinition form = new FormDefinition();
humanStep.setForm(form);
TextPropertyDefinition text = new TextPropertyDefinition();
text.setName("my text");
text.getParameters().put(AlfrescoConversionConstants.PARAMETER_ADD_PROPERTY_TO_OUTPUT, true);
FormPropertyGroup group = new FormPropertyGroup();
group.setId("group");
form.getFormGroups().add(group);
group.getFormPropertyDefinitions().add(text);
definition.addStep(humanStep);
WorkflowDefinitionConversion conversion = conversionFactory.createWorkflowDefinitionConversion(definition);
conversion.convert();
Process process = conversion.getProcess();
assertNotNull(process);
boolean listenerFound = false;
for (FlowElement flowElement : process.getFlowElements()) {
if (flowElement instanceof UserTask) {
UserTask task = (UserTask) flowElement;
assertNotNull(task.getTaskListeners());
assertEquals(2L, task.getTaskListeners().size());
assertEquals("create", task.getTaskListeners().get(0).getEvent());
assertEquals("complete", task.getTaskListeners().get(1).getEvent());
listenerFound = true;
}
}
assertTrue(listenerFound);
}
use of org.activiti.bpmn.model.Process in project Activiti by Activiti.
the class WorkflowDefinitionConversionTest method testTaskListenerForIncomingProperties.
@Test
public void testTaskListenerForIncomingProperties() throws Exception {
WorkflowDefinition definition = new WorkflowDefinition();
definition.setId("process");
HumanStepDefinition humanStep = new HumanStepDefinition();
humanStep.setId("step1");
FormDefinition form = new FormDefinition();
form.setFormKey("myform");
humanStep.setForm(form);
definition.addStep(humanStep);
WorkflowDefinitionConversion conversion = conversionFactory.createWorkflowDefinitionConversion(definition);
conversion.convert();
Process process = conversion.getProcess();
assertNotNull(process);
boolean listenerFound = false;
for (FlowElement flowElement : process.getFlowElements()) {
if (flowElement instanceof UserTask) {
UserTask task = (UserTask) flowElement;
assertNotNull(task.getTaskListeners());
assertEquals(1L, task.getTaskListeners().size());
assertEquals("create", task.getTaskListeners().get(0).getEvent());
listenerFound = true;
}
}
assertTrue(listenerFound);
}
Aggregations