Search in sources :

Example 1 with Definitions

use of org.camunda.bpm.model.bpmn.instance.Definitions in project camunda-bpmn-model by camunda.

the class GenerateIdTest method shouldNotGenerateIdsOnRead.

@Test
public void shouldNotGenerateIdsOnRead() {
    BpmnModelInstance modelInstance = Bpmn.readModelFromStream(GenerateIdTest.class.getResourceAsStream("GenerateIdTest.bpmn"));
    Definitions definitions = modelInstance.getDefinitions();
    assertThat(definitions.getId()).isNull();
    Process process = modelInstance.getModelElementsByType(Process.class).iterator().next();
    assertThat(process.getId()).isNull();
    StartEvent startEvent = modelInstance.getModelElementsByType(StartEvent.class).iterator().next();
    assertThat(startEvent.getId()).isNull();
    UserTask userTask = modelInstance.getModelElementsByType(UserTask.class).iterator().next();
    assertThat(userTask.getId()).isNull();
}
Also used : Definitions(org.camunda.bpm.model.bpmn.instance.Definitions) StartEvent(org.camunda.bpm.model.bpmn.instance.StartEvent) UserTask(org.camunda.bpm.model.bpmn.instance.UserTask) Process(org.camunda.bpm.model.bpmn.instance.Process) Test(org.junit.Test)

Example 2 with Definitions

use of org.camunda.bpm.model.bpmn.instance.Definitions 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)

Example 3 with Definitions

use of org.camunda.bpm.model.bpmn.instance.Definitions in project camunda-bpmn-model by camunda.

the class GenerateIdTest method shouldGenerateIdsOnCreate.

@Test
public void shouldGenerateIdsOnCreate() {
    BpmnModelInstance modelInstance = Bpmn.createEmptyModel();
    Definitions definitions = modelInstance.newInstance(Definitions.class);
    assertThat(definitions.getId()).isNotNull();
    Process process = modelInstance.newInstance(Process.class);
    assertThat(process.getId()).isNotNull();
    StartEvent startEvent = modelInstance.newInstance(StartEvent.class);
    assertThat(startEvent.getId()).isNotNull();
    UserTask userTask = modelInstance.newInstance(UserTask.class);
    assertThat(userTask.getId()).isNotNull();
}
Also used : Definitions(org.camunda.bpm.model.bpmn.instance.Definitions) StartEvent(org.camunda.bpm.model.bpmn.instance.StartEvent) UserTask(org.camunda.bpm.model.bpmn.instance.UserTask) Process(org.camunda.bpm.model.bpmn.instance.Process) Test(org.junit.Test)

Example 4 with Definitions

use of org.camunda.bpm.model.bpmn.instance.Definitions in project camunda-bpmn-model by camunda.

the class BpmnModelInstanceTest method testClone.

@Test
public void testClone() throws Exception {
    BpmnModelInstance modelInstance = Bpmn.createEmptyModel();
    Definitions definitions = modelInstance.newInstance(Definitions.class);
    definitions.setId("TestId");
    modelInstance.setDefinitions(definitions);
    BpmnModelInstance cloneInstance = modelInstance.clone();
    cloneInstance.getDefinitions().setId("TestId2");
    assertThat(modelInstance.getDefinitions().getId(), is(equalTo("TestId")));
    assertThat(cloneInstance.getDefinitions().getId(), is(equalTo("TestId2")));
}
Also used : Definitions(org.camunda.bpm.model.bpmn.instance.Definitions) Test(org.junit.Test)

Aggregations

Definitions (org.camunda.bpm.model.bpmn.instance.Definitions)4 Process (org.camunda.bpm.model.bpmn.instance.Process)3 Test (org.junit.Test)3 StartEvent (org.camunda.bpm.model.bpmn.instance.StartEvent)2 UserTask (org.camunda.bpm.model.bpmn.instance.UserTask)2 BpmnDiagram (org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnDiagram)1 BpmnPlane (org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnPlane)1