Search in sources :

Example 1 with StartEvent

use of io.camunda.zeebe.model.bpmn.instance.StartEvent in project zeebe by camunda.

the class ProcessBuilder method startEvent.

public StartEventBuilder startEvent(final String id) {
    final StartEvent start = createChild(StartEvent.class, id);
    final BpmnShape bpmnShape = createBpmnShape(start);
    setCoordinates(bpmnShape);
    return start.builder();
}
Also used : BpmnShape(io.camunda.zeebe.model.bpmn.instance.bpmndi.BpmnShape) StartEvent(io.camunda.zeebe.model.bpmn.instance.StartEvent)

Example 2 with StartEvent

use of io.camunda.zeebe.model.bpmn.instance.StartEvent in project zeebe by camunda.

the class GenerateIdTest method shouldGenerateIdsOnCreate.

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

Example 3 with StartEvent

use of io.camunda.zeebe.model.bpmn.instance.StartEvent in project zeebe by camunda.

the class SubProcessValidator method validate.

@Override
public void validate(final SubProcess element, final ValidationResultCollector validationResultCollector) {
    final Collection<StartEvent> startEvents = element.getChildElementsByType(StartEvent.class);
    if (startEvents.size() != 1) {
        validationResultCollector.addError(0, "Must have exactly one start event");
    }
    if (!startEvents.isEmpty()) {
        final StartEvent startEvent = startEvents.iterator().next();
        if (element.triggeredByEvent()) {
            validateEventSubprocess(validationResultCollector, startEvent);
        } else {
            validateEmbeddedSubprocess(validationResultCollector, startEvent);
        }
    }
    ModelUtil.verifyNoDuplicatedEventSubprocesses(element, error -> validationResultCollector.addError(0, error));
}
Also used : StartEvent(io.camunda.zeebe.model.bpmn.instance.StartEvent)

Example 4 with StartEvent

use of io.camunda.zeebe.model.bpmn.instance.StartEvent in project zeebe by camunda.

the class ProcessBuilderTest method testInterruptingStartEvent.

@Test
public void testInterruptingStartEvent() {
    modelInstance = Bpmn.createProcess().startEvent().endEvent().subProcess().triggerByEvent().embeddedSubProcess().startEvent("subProcessStart").interrupting(true).error().endEvent().done();
    final StartEvent startEvent = modelInstance.getModelElementById("subProcessStart");
    assertThat(startEvent).isNotNull();
    assertThat(startEvent.isInterrupting()).isTrue();
}
Also used : StartEvent(io.camunda.zeebe.model.bpmn.instance.StartEvent) Test(org.junit.Test)

Example 5 with StartEvent

use of io.camunda.zeebe.model.bpmn.instance.StartEvent in project zeebe by camunda.

the class EmbeddedSubProcessBuilder method startEvent.

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

Aggregations

StartEvent (io.camunda.zeebe.model.bpmn.instance.StartEvent)51 Test (org.junit.Test)27 Process (io.camunda.zeebe.model.bpmn.instance.Process)24 Definitions (io.camunda.zeebe.model.bpmn.instance.Definitions)15 Message (io.camunda.zeebe.model.bpmn.instance.Message)12 MessageEventDefinition (io.camunda.zeebe.model.bpmn.instance.MessageEventDefinition)12 UserTask (io.camunda.zeebe.model.bpmn.instance.UserTask)12 BpmnShape (io.camunda.zeebe.model.bpmn.instance.bpmndi.BpmnShape)9 BpmnModelInstance (io.camunda.zeebe.model.bpmn.BpmnModelInstance)6 EndEvent (io.camunda.zeebe.model.bpmn.instance.EndEvent)6 SubProcess (io.camunda.zeebe.model.bpmn.instance.SubProcess)6 Bounds (io.camunda.zeebe.model.bpmn.instance.dc.Bounds)6 ModelValidationException (org.camunda.bpm.model.xml.ModelValidationException)6 Bpmn (io.camunda.zeebe.model.bpmn.Bpmn)3 ProcessBuilder (io.camunda.zeebe.model.bpmn.builder.ProcessBuilder)3 BoundaryEvent (io.camunda.zeebe.model.bpmn.instance.BoundaryEvent)3 CatchEvent (io.camunda.zeebe.model.bpmn.instance.CatchEvent)3 EventDefinition (io.camunda.zeebe.model.bpmn.instance.EventDefinition)3 ExtensionElements (io.camunda.zeebe.model.bpmn.instance.ExtensionElements)3 IntermediateCatchEvent (io.camunda.zeebe.model.bpmn.instance.IntermediateCatchEvent)3