Java Code Examples for org.activiti.bpmn.model.StartEvent#getSubProcess()

The following examples show how to use org.activiti.bpmn.model.StartEvent#getSubProcess() . 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: EventSubProcessErrorStartEventActivityBehavior.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void execute(DelegateExecution execution) {
  StartEvent startEvent = (StartEvent) execution.getCurrentFlowElement();
  EventSubProcess eventSubProcess = (EventSubProcess) startEvent.getSubProcess();
  execution.setCurrentFlowElement(eventSubProcess);
  execution.setScope(true);

  // initialize the template-defined data objects as variables
  Map<String, Object> dataObjectVars = processDataObjects(eventSubProcess.getDataObjects());
  if (dataObjectVars != null) {
    execution.setVariablesLocal(dataObjectVars);
  }

  ExecutionEntity startSubProcessExecution = Context.getCommandContext()
      .getExecutionEntityManager().createChildExecution((ExecutionEntity) execution);
  startSubProcessExecution.setCurrentFlowElement(startEvent);
  Context.getAgenda().planTakeOutgoingSequenceFlowsOperation(startSubProcessExecution, true);
}
 
Example 2
Source File: StartEventParseHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
protected void executeParse(BpmnParse bpmnParse, StartEvent element) {
  if (element.getSubProcess() != null && element.getSubProcess() instanceof EventSubProcess) {
    if (CollectionUtil.isNotEmpty(element.getEventDefinitions())) {
      EventDefinition eventDefinition = element.getEventDefinitions().get(0);
      if (eventDefinition instanceof MessageEventDefinition) {
        MessageEventDefinition messageDefinition = (MessageEventDefinition) eventDefinition;
        BpmnModel bpmnModel = bpmnParse.getBpmnModel();
        String messageRef = messageDefinition.getMessageRef();
        if (bpmnModel.containsMessageId(messageRef)) {
          Message message = bpmnModel.getMessage(messageRef);
          messageDefinition.setMessageRef(message.getName());
          messageDefinition.setExtensionElements(message.getExtensionElements());
        }
        element.setBehavior(bpmnParse.getActivityBehaviorFactory().createEventSubProcessMessageStartEventActivityBehavior(element, messageDefinition));
      
      } else if (eventDefinition instanceof ErrorEventDefinition) {
        element.setBehavior(bpmnParse.getActivityBehaviorFactory().createEventSubProcessErrorStartEventActivityBehavior(element));
      }
    }
    
  } else if (CollectionUtil.isEmpty(element.getEventDefinitions())) {
    element.setBehavior(bpmnParse.getActivityBehaviorFactory().createNoneStartEventActivityBehavior(element));
  }
  
  if (element.getSubProcess() == null && (CollectionUtil.isEmpty(element.getEventDefinitions()) || 
      bpmnParse.getCurrentProcess().getInitialFlowElement() == null)) {

    bpmnParse.getCurrentProcess().setInitialFlowElement(element);
  }
}
 
Example 3
Source File: EventSubProcessMessageStartEventActivityBehavior.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void execute(DelegateExecution execution) {
  StartEvent startEvent = (StartEvent) execution.getCurrentFlowElement();
  EventSubProcess eventSubProcess = (EventSubProcess) startEvent.getSubProcess();

  execution.setScope(true);

  // initialize the template-defined data objects as variables
  Map<String, Object> dataObjectVars = processDataObjects(eventSubProcess.getDataObjects());
  if (dataObjectVars != null) {
    execution.setVariablesLocal(dataObjectVars);
  }
}