org.camunda.bpm.model.bpmn.instance.StartEvent Java Examples
The following examples show how to use
org.camunda.bpm.model.bpmn.instance.StartEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BpmnModelInstanceCmdTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@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); }
Example #2
Source File: BpmnProcessModelCustomizer.java From wecube-platform with Apache License 2.0 | 6 votes |
protected void enhanceSubProcesses(BpmnModelInstance procModelInstance) { Collection<SubProcess> subProcesses = procModelInstance.getModelElementsByType(SubProcess.class); for (SubProcess subProc : subProcesses) { log.info("subprocess {} {}", subProc.getId(), subProc.getName()); Collection<StartEvent> internalStartEvents = subProc.getChildElementsByType(StartEvent.class); if (!internalStartEvents.isEmpty()) { log.debug("subprocess {} {} already have child nodes and no need to supplement any nodes", subProc.getId(), subProc.getName()); continue; } supplementSubProcess(subProc); } }
Example #3
Source File: BpmnProcessModelCustomizer.java From wecube-platform with Apache License 2.0 | 6 votes |
protected void validateProcess(BpmnModelInstance procModelInstance) { org.camunda.bpm.model.bpmn.instance.Process process = procModelInstance .getModelElementsByType(org.camunda.bpm.model.bpmn.instance.Process.class).iterator().next(); Collection<StartEvent> procStartEvents = process.getChildElementsByType(StartEvent.class); Collection<EndEvent> procEndEvents = process.getChildElementsByType(EndEvent.class); if (procStartEvents.size() != 1) { log.warn("only one start event must provide for {} {}", process.getId(), process.getName()); throw new BpmnCustomizationException("Only one start event must provide."); } if (procEndEvents.size() < 1) { log.warn("at least one end event must provide for {} {}", process.getId(), process.getName()); throw new BpmnCustomizationException("At least one end event must provide."); } }
Example #4
Source File: AbstractEventSubProcessBuilder.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
public StartEventBuilder startEvent(String id) { StartEvent start = createChild(StartEvent.class, id); BpmnShape startShape = createBpmnShape(start); BpmnShape subProcessShape = findBpmnShape(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(); }
Example #5
Source File: EmbeddedSubProcessBuilder.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
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(); }
Example #6
Source File: AbstractEventSubProcessBuilder.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public StartEventBuilder startEvent(String id) { StartEvent start = createChild(StartEvent.class, id); BpmnShape startShape = createBpmnShape(start); BpmnShape subProcessShape = findBpmnShape(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(); }
Example #7
Source File: EmbeddedSubProcessBuilder.java From camunda-bpmn-model with Apache License 2.0 | 6 votes |
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(); }
Example #8
Source File: GenerateIdTest.java From camunda-bpmn-model with Apache License 2.0 | 5 votes |
@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(); }
Example #9
Source File: GenerateIdTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void shouldGenerateIdsOnCreate() { BpmnModelInstance modelInstance = Bpmn.createEmptyModel(); Definitions definitions = modelInstance.newInstance(Definitions.class); assertThat(definitions.getId()).isNotNull(); Process process = modelInstance.newInstance(Process.class); assertThat(process.getId()).isNotNull(); StartEvent startEvent = modelInstance.newInstance(StartEvent.class); assertThat(startEvent.getId()).isNotNull(); UserTask userTask = modelInstance.newInstance(UserTask.class); assertThat(userTask.getId()).isNotNull(); }
Example #10
Source File: GenerateIdTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@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(); }
Example #11
Source File: ProcessStartEventValidator.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public void validate(Process process, ValidationResultCollector validationResultCollector) { Collection<StartEvent> startEvents = process.getChildElementsByType(StartEvent.class); int startEventCount = startEvents.size(); if(startEventCount != 1) { validationResultCollector.addError(10, String.format("Process does not have exactly one start event. Got %d.", startEventCount)); } }
Example #12
Source File: StartEventImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
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(); }
Example #13
Source File: GenerateIdTest.java From camunda-bpmn-model with Apache License 2.0 | 5 votes |
@Test public void shouldGenerateIdsOnCreate() { BpmnModelInstance modelInstance = Bpmn.createEmptyModel(); Definitions definitions = modelInstance.newInstance(Definitions.class); assertThat(definitions.getId()).isNotNull(); Process process = modelInstance.newInstance(Process.class); assertThat(process.getId()).isNotNull(); StartEvent startEvent = modelInstance.newInstance(StartEvent.class); assertThat(startEvent.getId()).isNotNull(); UserTask userTask = modelInstance.newInstance(UserTask.class); assertThat(userTask.getId()).isNotNull(); }
Example #14
Source File: ProcessStartEventValidator.java From camunda-bpmn-model with Apache License 2.0 | 5 votes |
@Override public void validate(Process process, ValidationResultCollector validationResultCollector) { Collection<StartEvent> startEvents = process.getChildElementsByType(StartEvent.class); int startEventCount = startEvents.size(); if(startEventCount != 1) { validationResultCollector.addError(10, String.format("Process does not have exactly one start event. Got %d.", startEventCount)); } }
Example #15
Source File: StartEventImpl.java From camunda-bpmn-model with Apache License 2.0 | 5 votes |
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(); }
Example #16
Source File: WorkflowEngineService.java From wecube-platform with Apache License 2.0 | 4 votes |
public ProcInstOutline getProcInstOutline(String procInstId) { if (procInstId == null) { throw new WecubeCoreException("Process instance is null."); } ProcessInstanceStatusEntity procInstStatusEntity = processInstanceStatusRepository .findOneByprocInstanceId(procInstId); if (procInstStatusEntity == null) { log.warn("cannot find such process instance record with procInstId={}", procInstId); throw new WecubeCoreException("Such process instance record does not exist."); } String processInstanceId = null; String processDefinitionId = null; if (TraceStatus.Completed.equals(procInstStatusEntity.getStatus())) { processInstanceId = procInstStatusEntity.getProcInstanceId(); processDefinitionId = procInstStatusEntity.getProcDefinitionId(); } else { ProcessInstance existProcInst = getProcessInstanceByProcInstId(procInstId); if (existProcInst == null) { log.warn("such process instance does not exist,procInstId={}", procInstId); throw new WecubeCoreException("Such process instance does not exist."); } processInstanceId = existProcInst.getId(); processDefinitionId = existProcInst.getProcessDefinitionId(); } ProcessDefinition procDef = getProcessDefinitionByProcId(processDefinitionId); if (procDef == null) { log.warn("such process definition does not exist,procDefId={}", processDefinitionId); throw new WecubeCoreException("Such process definition does not exist."); } BpmnModelInstance bpmnModel = repositoryService.getBpmnModelInstance(procDef.getId()); Collection<org.camunda.bpm.model.bpmn.instance.Process> processes = bpmnModel .getModelElementsByType(org.camunda.bpm.model.bpmn.instance.Process.class); org.camunda.bpm.model.bpmn.instance.Process process = processes.iterator().next(); Collection<StartEvent> startEvents = process.getChildElementsByType(StartEvent.class); StartEvent startEvent = startEvents.iterator().next(); ProcInstOutline result = new ProcInstOutline(); result.setId(processInstanceId); result.setProcInstKey(procInstStatusEntity.getProcInstanceBizKey()); result.setProcDefKernelId(procDef.getId()); result.setProcDefKey(procDef.getKey()); result.setProcDefName(procDef.getName()); populateFlowNodeInsts(result, startEvent); refreshFlowNodeStatus(result); return result; }
Example #17
Source File: StartEventBuilder.java From camunda-bpmn-model with Apache License 2.0 | 4 votes |
public StartEventBuilder(BpmnModelInstance modelInstance, StartEvent element) { super(modelInstance, element, StartEventBuilder.class); }
Example #18
Source File: ProcessBuilder.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public StartEventBuilder startEvent(String id) { StartEvent start = createChild(StartEvent.class, id); BpmnShape bpmnShape = createBpmnShape(start); setCoordinates(bpmnShape); return start.builder(); }
Example #19
Source File: AbstractStartEventBuilder.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected AbstractStartEventBuilder(BpmnModelInstance modelInstance, StartEvent element, Class<?> selfType) { super(modelInstance, element, selfType); }
Example #20
Source File: StartEventBuilder.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public StartEventBuilder(BpmnModelInstance modelInstance, StartEvent element) { super(modelInstance, element, StartEventBuilder.class); }
Example #21
Source File: AbstractStartEventBuilder.java From camunda-bpmn-model with Apache License 2.0 | 4 votes |
protected AbstractStartEventBuilder(BpmnModelInstance modelInstance, StartEvent element, Class<?> selfType) { super(modelInstance, element, selfType); }
Example #22
Source File: ProcessBuilder.java From camunda-bpmn-model with Apache License 2.0 | 4 votes |
public StartEventBuilder startEvent(String id) { StartEvent start = createChild(StartEvent.class, id); BpmnShape bpmnShape = createBpmnShape(start); setCoordinates(bpmnShape); return start.builder(); }
Example #23
Source File: WorkflowEngineService.java From wecube-platform with Apache License 2.0 | 4 votes |
public ProcDefOutline getProcDefOutline(ProcessDefinition procDef) { ProcDefOutline pdo = new ProcDefOutline(); pdo.setId(procDef.getId()); pdo.setProcDefKey(procDef.getKey()); pdo.setProcDefName(procDef.getName()); BpmnModelInstance bpmnModel = repositoryService.getBpmnModelInstance(procDef.getId()); Collection<org.camunda.bpm.model.bpmn.instance.Process> processes = bpmnModel .getModelElementsByType(org.camunda.bpm.model.bpmn.instance.Process.class); org.camunda.bpm.model.bpmn.instance.Process process = processes.iterator().next(); Collection<StartEvent> startEvents = process.getChildElementsByType(StartEvent.class); StartEvent startEvent = startEvents.iterator().next(); populateFlowNodes(pdo, startEvent); return pdo; }
Example #24
Source File: WorkflowEngineService.java From wecube-platform with Apache License 2.0 | 4 votes |
public ProcDefOutline readProcDefOutlineFromXmlData(String xmlData) { BpmnModelInstance bpmnModel = readModelFromXmlData(xmlData); ProcDefOutline pdo = new ProcDefOutline(); Collection<org.camunda.bpm.model.bpmn.instance.Process> processes = bpmnModel .getModelElementsByType(org.camunda.bpm.model.bpmn.instance.Process.class); org.camunda.bpm.model.bpmn.instance.Process process = processes.iterator().next(); // pdo.setProcDefKey(process.getKey()); pdo.setProcDefName(process.getName()); Collection<StartEvent> startEvents = process.getChildElementsByType(StartEvent.class); StartEvent startEvent = startEvents.iterator().next(); populateFlowNodes(pdo, startEvent); return pdo; }