use of org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnDiagram in project camunda-bpmn-model by camunda.
the class BpmnDiagramImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(BpmnDiagram.class, BPMNDI_ELEMENT_BPMN_DIAGRAM).namespaceUri(BPMNDI_NS).extendsType(Diagram.class).instanceProvider(new ModelTypeInstanceProvider<BpmnDiagram>() {
public BpmnDiagram newInstance(ModelTypeInstanceContext instanceContext) {
return new BpmnDiagramImpl(instanceContext);
}
});
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
bpmnPlaneChild = sequenceBuilder.element(BpmnPlane.class).required().build();
bpmnLabelStyleCollection = sequenceBuilder.elementCollection(BpmnLabelStyle.class).build();
typeBuilder.build();
}
use of org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnDiagram in project camunda-bpmn-model by camunda.
the class DiGeneratorForFlowNodesTest method shouldGeneratePlaneForProcess.
@Test
public void shouldGeneratePlaneForProcess() {
// when
instance = Bpmn.createExecutableProcess("process").done();
// then
Collection<BpmnDiagram> bpmnDiagrams = instance.getModelElementsByType(BpmnDiagram.class);
assertEquals(1, bpmnDiagrams.size());
BpmnDiagram diagram = bpmnDiagrams.iterator().next();
assertNotNull(diagram.getId());
assertNotNull(diagram.getBpmnPlane());
assertEquals(diagram.getBpmnPlane().getBpmnElement(), instance.getModelElementById("process"));
}
use of org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnDiagram in project camunda-bpmn-model by camunda.
the class Bpmn method createProcess.
public static ProcessBuilder createProcess() {
BpmnModelInstance modelInstance = INSTANCE.doCreateEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);
definitions.setTargetNamespace(BPMN20_NS);
definitions.getDomElement().registerNamespace("camunda", CAMUNDA_NS);
modelInstance.setDefinitions(definitions);
Process process = modelInstance.newInstance(Process.class);
definitions.addChildElement(process);
BpmnDiagram bpmnDiagram = modelInstance.newInstance(BpmnDiagram.class);
BpmnPlane bpmnPlane = modelInstance.newInstance(BpmnPlane.class);
bpmnPlane.setBpmnElement(process);
bpmnDiagram.addChildElement(bpmnPlane);
definitions.addChildElement(bpmnDiagram);
return process.builder();
}
Aggregations