Search in sources :

Example 1 with BpmnDiagram

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();
}
Also used : BpmnPlane(org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnPlane) SequenceBuilder(org.camunda.bpm.model.xml.type.child.SequenceBuilder) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) BpmnDiagram(org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnDiagram) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext) BpmnDiagram(org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnDiagram) Diagram(org.camunda.bpm.model.bpmn.instance.di.Diagram)

Example 2 with BpmnDiagram

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"));
}
Also used : BpmnDiagram(org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnDiagram) Test(org.junit.Test)

Example 3 with BpmnDiagram

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();
}
Also used : BpmnPlane(org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnPlane) Definitions(org.camunda.bpm.model.bpmn.instance.Definitions) Process(org.camunda.bpm.model.bpmn.instance.Process) BpmnDiagram(org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnDiagram)

Aggregations

BpmnDiagram (org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnDiagram)3 BpmnPlane (org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnPlane)2 Definitions (org.camunda.bpm.model.bpmn.instance.Definitions)1 Process (org.camunda.bpm.model.bpmn.instance.Process)1 Diagram (org.camunda.bpm.model.bpmn.instance.di.Diagram)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1 SequenceBuilder (org.camunda.bpm.model.xml.type.child.SequenceBuilder)1 Test (org.junit.Test)1