Search in sources :

Example 1 with Activity

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

the class ProcessBuilderTest method testCompensateEventDefintionCatchBoundaryEvent.

@Test
public void testCompensateEventDefintionCatchBoundaryEvent() {
    modelInstance = Bpmn.createProcess().startEvent().userTask("userTask").boundaryEvent("catch").compensateEventDefinition().waitForCompletion(false).compensateEventDefinitionDone().endEvent("end").done();
    final CompensateEventDefinition eventDefinition = assertAndGetSingleEventDefinition("catch", CompensateEventDefinition.class);
    final Activity activity = eventDefinition.getActivity();
    assertThat(activity).isNull();
    assertThat(eventDefinition.isWaitForCompletion()).isFalse();
}
Also used : Activity(io.camunda.zeebe.model.bpmn.instance.Activity) CompensateEventDefinition(io.camunda.zeebe.model.bpmn.instance.CompensateEventDefinition) Test(org.junit.Test)

Example 2 with Activity

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

the class ProcessBuilderTest method testCompensateEventDefintionCatchStartEvent.

@Test
public void testCompensateEventDefintionCatchStartEvent() {
    modelInstance = Bpmn.createProcess().startEvent("start").compensateEventDefinition().waitForCompletion(false).compensateEventDefinitionDone().userTask("userTask").endEvent("end").done();
    final CompensateEventDefinition eventDefinition = assertAndGetSingleEventDefinition("start", CompensateEventDefinition.class);
    final Activity activity = eventDefinition.getActivity();
    assertThat(activity).isNull();
    assertThat(eventDefinition.isWaitForCompletion()).isFalse();
}
Also used : Activity(io.camunda.zeebe.model.bpmn.instance.Activity) CompensateEventDefinition(io.camunda.zeebe.model.bpmn.instance.CompensateEventDefinition) Test(org.junit.Test)

Example 3 with Activity

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

the class ProcessBuilderTest method testCompensateEventDefintionThrowEndEvent.

@Test
public void testCompensateEventDefintionThrowEndEvent() {
    modelInstance = Bpmn.createProcess().startEvent().userTask("userTask").endEvent("end").compensateEventDefinition().activityRef("userTask").waitForCompletion(true).compensateEventDefinitionDone().done();
    final CompensateEventDefinition eventDefinition = assertAndGetSingleEventDefinition("end", CompensateEventDefinition.class);
    final Activity activity = eventDefinition.getActivity();
    assertThat(activity).isEqualTo(modelInstance.getModelElementById("userTask"));
    assertThat(eventDefinition.isWaitForCompletion()).isTrue();
}
Also used : Activity(io.camunda.zeebe.model.bpmn.instance.Activity) CompensateEventDefinition(io.camunda.zeebe.model.bpmn.instance.CompensateEventDefinition) Test(org.junit.Test)

Example 4 with Activity

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

the class AbstractBaseElementBuilder method createBpmnShape.

public BpmnShape createBpmnShape(final FlowNode node) {
    final BpmnPlane bpmnPlane = findBpmnPlane();
    if (bpmnPlane != null) {
        final BpmnShape bpmnShape = createInstance(BpmnShape.class);
        bpmnShape.setBpmnElement(node);
        final Bounds nodeBounds = createInstance(Bounds.class);
        if (node instanceof SubProcess) {
            bpmnShape.setExpanded(true);
            nodeBounds.setWidth(350);
            nodeBounds.setHeight(200);
        } else if (node instanceof Activity) {
            nodeBounds.setWidth(100);
            nodeBounds.setHeight(80);
        } else if (node instanceof Event) {
            nodeBounds.setWidth(36);
            nodeBounds.setHeight(36);
        } else if (node instanceof Gateway) {
            nodeBounds.setWidth(50);
            nodeBounds.setHeight(50);
            if (node instanceof ExclusiveGateway) {
                bpmnShape.setMarkerVisible(true);
            }
        }
        nodeBounds.setX(0);
        nodeBounds.setY(0);
        bpmnShape.addChildElement(nodeBounds);
        bpmnPlane.addChildElement(bpmnShape);
        return bpmnShape;
    }
    return null;
}
Also used : SubProcess(io.camunda.zeebe.model.bpmn.instance.SubProcess) ExclusiveGateway(io.camunda.zeebe.model.bpmn.instance.ExclusiveGateway) BpmnPlane(io.camunda.zeebe.model.bpmn.instance.bpmndi.BpmnPlane) BpmnShape(io.camunda.zeebe.model.bpmn.instance.bpmndi.BpmnShape) ExclusiveGateway(io.camunda.zeebe.model.bpmn.instance.ExclusiveGateway) Gateway(io.camunda.zeebe.model.bpmn.instance.Gateway) Bounds(io.camunda.zeebe.model.bpmn.instance.dc.Bounds) Activity(io.camunda.zeebe.model.bpmn.instance.Activity) Event(io.camunda.zeebe.model.bpmn.instance.Event)

Example 5 with Activity

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

the class AbstractCompensateEventDefinitionBuilder method activityRef.

public B activityRef(final String activityId) {
    final Activity activity = modelInstance.getModelElementById(activityId);
    if (activity == null) {
        throw new BpmnModelException("Activity with id '" + activityId + "' does not exist");
    }
    final Event event = (Event) element.getParentElement();
    if (activity.getParentElement() != event.getParentElement()) {
        throw new BpmnModelException("Activity with id '" + activityId + "' must be in the same scope as '" + event.getId() + "'");
    }
    element.setActivity(activity);
    return myself;
}
Also used : BpmnModelException(io.camunda.zeebe.model.bpmn.BpmnModelException) Activity(io.camunda.zeebe.model.bpmn.instance.Activity) Event(io.camunda.zeebe.model.bpmn.instance.Event)

Aggregations

Activity (io.camunda.zeebe.model.bpmn.instance.Activity)21 CompensateEventDefinition (io.camunda.zeebe.model.bpmn.instance.CompensateEventDefinition)12 Test (org.junit.Test)12 Event (io.camunda.zeebe.model.bpmn.instance.Event)6 ExecutableActivity (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableActivity)3 BpmnModelException (io.camunda.zeebe.model.bpmn.BpmnModelException)3 ExclusiveGateway (io.camunda.zeebe.model.bpmn.instance.ExclusiveGateway)3 Gateway (io.camunda.zeebe.model.bpmn.instance.Gateway)3 SubProcess (io.camunda.zeebe.model.bpmn.instance.SubProcess)3 BpmnPlane (io.camunda.zeebe.model.bpmn.instance.bpmndi.BpmnPlane)3 BpmnShape (io.camunda.zeebe.model.bpmn.instance.bpmndi.BpmnShape)3 Bounds (io.camunda.zeebe.model.bpmn.instance.dc.Bounds)3