Search in sources :

Example 6 with StartEvent

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

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

the class AbstractEventSubProcessBuilder method startEvent.

public StartEventBuilder startEvent(String id) {
    StartEvent start = createChild(StartEvent.class, id);
    BpmnShape startShape = createBpmnShape(start);
    BpmnShape subProcessShape = findBpmnShape(getElement());
    if (subProcessShape != null) {
        Bounds subProcessBounds = subProcessShape.getBounds();
        Bounds startBounds = startShape.getBounds();
        double subProcessX = subProcessBounds.getX();
        double subProcessY = subProcessBounds.getY();
        double subProcessHeight = subProcessBounds.getHeight();
        double startHeight = startBounds.getHeight();
        startBounds.setX(subProcessX + SPACE);
        startBounds.setY(subProcessY + subProcessHeight / 2 - startHeight / 2);
    }
    return start.builder();
}
Also used : BpmnShape(org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape) Bounds(org.camunda.bpm.model.bpmn.instance.dc.Bounds) StartEvent(org.camunda.bpm.model.bpmn.instance.StartEvent)

Aggregations

StartEvent (org.camunda.bpm.model.bpmn.instance.StartEvent)7 BpmnShape (org.camunda.bpm.model.bpmn.instance.bpmndi.BpmnShape)3 Definitions (org.camunda.bpm.model.bpmn.instance.Definitions)2 Process (org.camunda.bpm.model.bpmn.instance.Process)2 UserTask (org.camunda.bpm.model.bpmn.instance.UserTask)2 Bounds (org.camunda.bpm.model.bpmn.instance.dc.Bounds)2 Test (org.junit.Test)2 Deployment (org.camunda.bpm.engine.test.Deployment)1 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)1 CatchEvent (org.camunda.bpm.model.bpmn.instance.CatchEvent)1 Event (org.camunda.bpm.model.bpmn.instance.Event)1 SequenceFlow (org.camunda.bpm.model.bpmn.instance.SequenceFlow)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementInstance (org.camunda.bpm.model.xml.instance.ModelElementInstance)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1