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