org.camunda.bpm.model.bpmn.instance.EndEvent Java Examples

The following examples show how to use org.camunda.bpm.model.bpmn.instance.EndEvent. 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: BpmnProcessModelCustomizer.java    From wecube-platform with Apache License 2.0 6 votes vote down vote up
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 #2
Source File: EndEventImpl.java    From camunda-bpmn-model with Apache License 2.0 5 votes vote down vote up
public static void registerType(ModelBuilder modelBuilder) {
  ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(EndEvent.class, BPMN_ELEMENT_END_EVENT)
    .namespaceUri(BPMN20_NS)
    .extendsType(ThrowEvent.class)
    .instanceProvider(new ModelTypeInstanceProvider<EndEvent>() {
      public EndEvent newInstance(ModelTypeInstanceContext instanceContext) {
        return new EndEventImpl(instanceContext);
      }
    });
  
  typeBuilder.build();
}
 
Example #3
Source File: AbstractBpmnModelElementBuilder.java    From camunda-bpmn-model with Apache License 2.0 5 votes vote down vote up
public AbstractThrowEventBuilder throwEventDefinitionDone() {
  ModelElementInstance lastEvent = element.getDomElement().getParentElement().getModelElementInstance();
  if (lastEvent != null && lastEvent instanceof IntermediateThrowEvent) {
    return new IntermediateThrowEventBuilder(modelInstance, (IntermediateThrowEvent) lastEvent);
  } else if (lastEvent != null && lastEvent instanceof EndEvent) {
    return new EndEventBuilder(modelInstance, (EndEvent) lastEvent);
  }
  else {
    throw new BpmnModelException("Unable to find a parent event.");
  }
}
 
Example #4
Source File: EndEventImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public static void registerType(ModelBuilder modelBuilder) {
  ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(EndEvent.class, BPMN_ELEMENT_END_EVENT)
    .namespaceUri(BPMN20_NS)
    .extendsType(ThrowEvent.class)
    .instanceProvider(new ModelTypeInstanceProvider<EndEvent>() {
      public EndEvent newInstance(ModelTypeInstanceContext instanceContext) {
        return new EndEventImpl(instanceContext);
      }
    });
  
  typeBuilder.build();
}
 
Example #5
Source File: AbstractBpmnModelElementBuilder.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public AbstractThrowEventBuilder throwEventDefinitionDone() {
  ModelElementInstance lastEvent = element.getDomElement().getParentElement().getModelElementInstance();
  if (lastEvent != null && lastEvent instanceof IntermediateThrowEvent) {
    return new IntermediateThrowEventBuilder(modelInstance, (IntermediateThrowEvent) lastEvent);
  } else if (lastEvent != null && lastEvent instanceof EndEvent) {
    return new EndEventBuilder(modelInstance, (EndEvent) lastEvent);
  }
  else {
    throw new BpmnModelException("Unable to find a parent event.");
  }
}
 
Example #6
Source File: ExampleExecutionListenerEnd.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void notify(DelegateExecution execution) throws Exception {
  boolean instanceEnded = execution.getBpmnModelElementInstance() instanceof EndEvent;
  boolean instanceCanceled = execution.getProcessInstance() != null && execution.getProcessInstance().isCanceled();
  if (instanceCanceled) {
    execution.setVariable("canceled", true);
  } else if (instanceEnded) {
    execution.setVariable("finished", true);
  } else {
    execution.setVariable("running", true);
  }
}
 
Example #7
Source File: BpmnProcessModelCustomizer.java    From wecube-platform with Apache License 2.0 4 votes vote down vote up
protected void enhanceEndEvents(BpmnModelInstance procModelInstance) {
    Collection<EndEvent> endEvents = procModelInstance.getModelElementsByType(EndEvent.class);
    for (EndEvent endEvent : endEvents) {
        enhanceEndEvent(endEvent);
    }
}
 
Example #8
Source File: AbstractEndEventBuilder.java    From camunda-bpmn-model with Apache License 2.0 4 votes vote down vote up
protected AbstractEndEventBuilder(BpmnModelInstance modelInstance, EndEvent element, Class<?> selfType) {
  super(modelInstance, element, selfType);
}
 
Example #9
Source File: EndEventBuilder.java    From camunda-bpmn-model with Apache License 2.0 4 votes vote down vote up
public EndEventBuilder(BpmnModelInstance modelInstance, EndEvent element) {
  super(modelInstance, element, EndEventBuilder.class);
}
 
Example #10
Source File: AbstractEndEventBuilder.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
protected AbstractEndEventBuilder(BpmnModelInstance modelInstance, EndEvent element, Class<?> selfType) {
  super(modelInstance, element, selfType);
}
 
Example #11
Source File: EndEventBuilder.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public EndEventBuilder(BpmnModelInstance modelInstance, EndEvent element) {
  super(modelInstance, element, EndEventBuilder.class);
}
 
Example #12
Source File: SelfCancellationTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public static void initEndEvent(BpmnModelInstance modelInstance, String endEventId) {
  EndEvent endEvent = modelInstance.getModelElementById(endEventId);
  TerminateEventDefinition terminateDefinition = modelInstance.newInstance(TerminateEventDefinition.class);
  endEvent.addChildElement(terminateDefinition);
}
 
Example #13
Source File: HistoricProcessInstanceStateTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
protected static void initEndEvent(BpmnModelInstance modelInstance, String endEventId) {
  EndEvent endEvent = modelInstance.getModelElementById(endEventId);
  TerminateEventDefinition terminateDefinition = modelInstance.newInstance(TerminateEventDefinition.class);
  endEvent.addChildElement(terminateDefinition);
}