Search in sources :

Example 1 with StartEvent

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

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

the class ProcessBuilder method startEvent.

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

Example 3 with StartEvent

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

the class BpmnModelInstanceCmdTest method testRepositoryService.

@Deployment(resources = "org/camunda/bpm/engine/test/repository/one.bpmn20.xml")
public void testRepositoryService() {
    String processDefinitionId = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_KEY).singleResult().getId();
    BpmnModelInstance modelInstance = repositoryService.getBpmnModelInstance(processDefinitionId);
    assertNotNull(modelInstance);
    Collection<ModelElementInstance> events = modelInstance.getModelElementsByType(modelInstance.getModel().getType(Event.class));
    assertEquals(2, events.size());
    Collection<ModelElementInstance> sequenceFlows = modelInstance.getModelElementsByType(modelInstance.getModel().getType(SequenceFlow.class));
    assertEquals(1, sequenceFlows.size());
    StartEvent startEvent = modelInstance.getModelElementById("start");
    assertNotNull(startEvent);
}
Also used : ModelElementInstance(org.camunda.bpm.model.xml.instance.ModelElementInstance) SequenceFlow(org.camunda.bpm.model.bpmn.instance.SequenceFlow) StartEvent(org.camunda.bpm.model.bpmn.instance.StartEvent) Event(org.camunda.bpm.model.bpmn.instance.Event) StartEvent(org.camunda.bpm.model.bpmn.instance.StartEvent) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 4 with StartEvent

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

the class StartEventImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(StartEvent.class, BPMN_ELEMENT_START_EVENT).namespaceUri(BPMN20_NS).extendsType(CatchEvent.class).instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider<StartEvent>() {

        public StartEvent newInstance(ModelTypeInstanceContext instanceContext) {
            return new StartEventImpl(instanceContext);
        }
    });
    isInterruptingAttribute = typeBuilder.booleanAttribute(BPMN_ATTRIBUTE_IS_INTERRUPTING).defaultValue(true).build();
    /**
     * camunda extensions
     */
    camundaAsyncAttribute = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC).namespace(CAMUNDA_NS).defaultValue(false).build();
    camundaFormHandlerClassAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_FORM_HANDLER_CLASS).namespace(CAMUNDA_NS).build();
    camundaFormKeyAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_FORM_KEY).namespace(CAMUNDA_NS).build();
    camundaInitiatorAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_INITIATOR).namespace(CAMUNDA_NS).build();
    typeBuilder.build();
}
Also used : StartEvent(org.camunda.bpm.model.bpmn.instance.StartEvent) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) CatchEvent(org.camunda.bpm.model.bpmn.instance.CatchEvent) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Example 5 with StartEvent

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

the class EmbeddedSubProcessBuilder method startEvent.

public StartEventBuilder startEvent(String id) {
    StartEvent start = subProcessBuilder.createChild(StartEvent.class, id);
    BpmnShape startShape = subProcessBuilder.createBpmnShape(start);
    BpmnShape subProcessShape = subProcessBuilder.findBpmnShape(subProcessBuilder.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