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();
}
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();
}
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));
}
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();
}
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();
}
Aggregations