org.flowable.bpmn.model.Activity.getBoundaryEvents()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(275)

本文整理了Java中org.flowable.bpmn.model.Activity.getBoundaryEvents()方法的一些代码示例,展示了Activity.getBoundaryEvents()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getBoundaryEvents()方法的具体详情如下:
包路径:org.flowable.bpmn.model.Activity
类名称:Activity
方法名:getBoundaryEvents

Activity.getBoundaryEvents介绍

暂无

代码示例

代码示例来源:origin: org.flowable/flowable-engine

protected Activity verifyCompensation(DelegateExecution execution, ExecutionEntity executionToUse, Activity activity) {
  boolean hasCompensation = false;
  if (activity instanceof Transaction) {
    hasCompensation = true;
  } else if (activity instanceof SubProcess) {
    SubProcess subProcess = (SubProcess) activity;
    for (FlowElement subElement : subProcess.getFlowElements()) {
      if (subElement instanceof Activity) {
        Activity subActivity = (Activity) subElement;
        if (CollectionUtil.isNotEmpty(subActivity.getBoundaryEvents())) {
          for (BoundaryEvent boundaryEvent : subActivity.getBoundaryEvents()) {
            if (CollectionUtil.isNotEmpty(boundaryEvent.getEventDefinitions()) &&
                boundaryEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition) {
              hasCompensation = true;
              break;
            }
          }
        }
      }
    }
  }
  if (hasCompensation) {
    ScopeUtil.createCopyOfSubProcessExecutionForCompensation(executionToUse);
  }
  return activity;
}

代码示例来源:origin: org.flowable/flowable-engine

protected void cleanupExecutions(FlowElement currentFlowElement) {
  if (execution.getParentId() != null && execution.isScope()) {
    // If the execution is a scope (and not a process instance), the scope must first be
    // destroyed before we can continue and follow the sequence flow
    agenda.planDestroyScopeOperation(execution);
  } else if (currentFlowElement instanceof Activity) {
    // If the current activity is an activity, we need to remove any currently active boundary events
    Activity activity = (Activity) currentFlowElement;
    if (CollectionUtil.isNotEmpty(activity.getBoundaryEvents())) {
      // Cancel events are not removed
      List<String> notToDeleteEvents = new ArrayList<>();
      for (BoundaryEvent event : activity.getBoundaryEvents()) {
        if (CollectionUtil.isNotEmpty(event.getEventDefinitions()) &&
            event.getEventDefinitions().get(0) instanceof CancelEventDefinition) {
          notToDeleteEvents.add(event.getId());
        }
      }
      // Delete all child executions
      Collection<ExecutionEntity> childExecutions = CommandContextUtil.getExecutionEntityManager(commandContext).findChildExecutionsByParentExecutionId(execution.getId());
      for (ExecutionEntity childExecution : childExecutions) {
        if (childExecution.getCurrentFlowElement() == null || !notToDeleteEvents.contains(childExecution.getCurrentFlowElement().getId())) {
          CommandContextUtil.getExecutionEntityManager(commandContext).deleteExecutionAndRelatedData(childExecution, null, false);
        }
      }
    }
  }
}

代码示例来源:origin: org.ow2.petals.flowable/flowable-bpmn-model

public void setValues(Activity otherActivity) {
    super.setValues(otherActivity);
    setFailedJobRetryTimeCycleValue(otherActivity.getFailedJobRetryTimeCycleValue());
    setDefaultFlow(otherActivity.getDefaultFlow());
    setForCompensation(otherActivity.isForCompensation());
    if (otherActivity.getLoopCharacteristics() != null) {
      setLoopCharacteristics(otherActivity.getLoopCharacteristics().clone());
    }
    if (otherActivity.getIoSpecification() != null) {
      setIoSpecification(otherActivity.getIoSpecification().clone());
    }

    dataInputAssociations = new ArrayList<>();
    if (otherActivity.getDataInputAssociations() != null && !otherActivity.getDataInputAssociations().isEmpty()) {
      for (DataAssociation association : otherActivity.getDataInputAssociations()) {
        dataInputAssociations.add(association.clone());
      }
    }

    dataOutputAssociations = new ArrayList<>();
    if (otherActivity.getDataOutputAssociations() != null && !otherActivity.getDataOutputAssociations().isEmpty()) {
      for (DataAssociation association : otherActivity.getDataOutputAssociations()) {
        dataOutputAssociations.add(association.clone());
      }
    }

    boundaryEvents.clear();
    boundaryEvents.addAll(otherActivity.getBoundaryEvents());
  }
}

代码示例来源:origin: org.flowable/flowable-bpmn-model

public void setValues(Activity otherActivity) {
    super.setValues(otherActivity);
    setFailedJobRetryTimeCycleValue(otherActivity.getFailedJobRetryTimeCycleValue());
    setDefaultFlow(otherActivity.getDefaultFlow());
    setForCompensation(otherActivity.isForCompensation());
    if (otherActivity.getLoopCharacteristics() != null) {
      setLoopCharacteristics(otherActivity.getLoopCharacteristics().clone());
    }
    if (otherActivity.getIoSpecification() != null) {
      setIoSpecification(otherActivity.getIoSpecification().clone());
    }

    dataInputAssociations = new ArrayList<>();
    if (otherActivity.getDataInputAssociations() != null && !otherActivity.getDataInputAssociations().isEmpty()) {
      for (DataAssociation association : otherActivity.getDataInputAssociations()) {
        dataInputAssociations.add(association.clone());
      }
    }

    dataOutputAssociations = new ArrayList<>();
    if (otherActivity.getDataOutputAssociations() != null && !otherActivity.getDataOutputAssociations().isEmpty()) {
      for (DataAssociation association : otherActivity.getDataOutputAssociations()) {
        dataOutputAssociations.add(association.clone());
      }
    }

    boundaryEvents.clear();
    boundaryEvents.addAll(otherActivity.getBoundaryEvents());
  }
}

代码示例来源:origin: org.flowable/flowable-bpmn-converter

protected void processFlowElements(Collection<FlowElement> flowElementList, BaseElement parentScope) {
  for (FlowElement flowElement : flowElementList) {
    if (flowElement instanceof SequenceFlow) {
      SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
      FlowNode sourceNode = getFlowNodeFromScope(sequenceFlow.getSourceRef(), parentScope);
      if (sourceNode != null) {
        sourceNode.getOutgoingFlows().add(sequenceFlow);
        sequenceFlow.setSourceFlowElement(sourceNode);
      }
      FlowNode targetNode = getFlowNodeFromScope(sequenceFlow.getTargetRef(), parentScope);
      if (targetNode != null) {
        targetNode.getIncomingFlows().add(sequenceFlow);
        sequenceFlow.setTargetFlowElement(targetNode);
      }
    } else if (flowElement instanceof BoundaryEvent) {
      BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
      FlowElement attachedToElement = getFlowNodeFromScope(boundaryEvent.getAttachedToRefId(), parentScope);
      if (attachedToElement instanceof Activity) {
        Activity attachedActivity = (Activity) attachedToElement;
        boundaryEvent.setAttachedToRef(attachedActivity);
        attachedActivity.getBoundaryEvents().add(boundaryEvent);
      }
    } else if (flowElement instanceof SubProcess) {
      SubProcess subProcess = (SubProcess) flowElement;
      processFlowElements(subProcess.getFlowElements(), subProcess);
    }
  }
}

代码示例来源:origin: org.flowable/flowable-json-converter

for (BoundaryEvent boundaryEvent : activity.getBoundaryEvents()) {
  outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(boundaryEvent.getId()));

代码示例来源:origin: org.flowable/flowable-json-converter

} else {
  boundaryEvent.setAttachedToRef(activity);
  activity.getBoundaryEvents().add(boundaryEvent);

代码示例来源:origin: org.flowable/flowable-engine

if (subElement instanceof Activity) {
  Activity subActivity = (Activity) subElement;
  if (CollectionUtil.isNotEmpty(subActivity.getBoundaryEvents())) {
    for (BoundaryEvent boundaryEvent : subActivity.getBoundaryEvents()) {
      if (CollectionUtil.isNotEmpty(boundaryEvent.getEventDefinitions()) &&
          boundaryEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition) {

代码示例来源:origin: org.flowable/flowable-engine

protected void executeSynchronous(FlowNode flowNode) {
  CommandContextUtil.getActivityInstanceEntityManager(commandContext).recordActivityStart(execution);
  // Execution listener: event 'start'
  if (CollectionUtil.isNotEmpty(flowNode.getExecutionListeners())) {
    executeExecutionListeners(flowNode, ExecutionListener.EVENTNAME_START);
  }
  // Create any boundary events, sub process boundary events will be created from the activity behavior
  List<ExecutionEntity> boundaryEventExecutions = null;
  List<BoundaryEvent> boundaryEvents = null;
  if (!inCompensation && flowNode instanceof Activity) { // Only activities can have boundary events
    boundaryEvents = ((Activity) flowNode).getBoundaryEvents();
    if (CollectionUtil.isNotEmpty(boundaryEvents)) {
      boundaryEventExecutions = createBoundaryEvents(boundaryEvents, execution);
    }
  }
  // Execute actual behavior
  ActivityBehavior activityBehavior = (ActivityBehavior) flowNode.getBehavior();
  if (activityBehavior != null) {
    executeActivityBehavior(activityBehavior, flowNode);
    executeBoundaryEvents(boundaryEvents, boundaryEventExecutions);
  } else {
    executeBoundaryEvents(boundaryEvents, boundaryEventExecutions);
    LOGGER.debug("No activityBehavior on activity '{}' with execution {}", flowNode.getId(), execution.getId());
    CommandContextUtil.getAgenda().planTakeOutgoingSequenceFlowsOperation(execution, true);
  }
}

代码示例来源:origin: org.flowable/flowable-engine

List<BoundaryEvent> boundaryEvents = ((Activity) newFlowElement).getBoundaryEvents();
if (boundaryEvents != null && !boundaryEvents.isEmpty()) {
  List<ExecutionEntity> boundaryEventsExecutions = createBoundaryEvents(boundaryEvents, childExecution, commandContext);

代码示例来源:origin: org.flowable/flowable-engine

protected void executeMultiInstanceSynchronous(FlowNode flowNode) {
  // Execution listener: event 'start'
  if (CollectionUtil.isNotEmpty(flowNode.getExecutionListeners())) {
    executeExecutionListeners(flowNode, ExecutionListener.EVENTNAME_START);
  }
  
  if (!hasMultiInstanceRootExecution(execution, flowNode)) {
    execution = createMultiInstanceRootExecution(execution);
  }
  // Create any boundary events, sub process boundary events will be created from the activity behavior
  List<ExecutionEntity> boundaryEventExecutions = null;
  List<BoundaryEvent> boundaryEvents = null;
  if (!inCompensation && flowNode instanceof Activity) { // Only activities can have boundary events
    boundaryEvents = ((Activity) flowNode).getBoundaryEvents();
    if (CollectionUtil.isNotEmpty(boundaryEvents)) {
      boundaryEventExecutions = createBoundaryEvents(boundaryEvents, execution);
    }
  }
  // Execute the multi instance behavior
  ActivityBehavior activityBehavior = (ActivityBehavior) flowNode.getBehavior();
  if (activityBehavior != null) {
    executeActivityBehavior(activityBehavior, flowNode);
    executeBoundaryEvents(boundaryEvents, boundaryEventExecutions);
  } else {
    throw new FlowableException("Expected an activity behavior in flow node " + flowNode.getId());
  }
}

代码示例来源:origin: org.flowable/flowable-engine

if (!activity.isForCompensation() && activity.getBoundaryEvents().size() > 0) {
  for (BoundaryEvent boundaryEvent : activity.getBoundaryEvents()) {
    if (boundaryEvent.getEventDefinitions().size() > 0 && boundaryEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition) {
      List<Association> associations = process.findAssociationsWithSourceRefRecursive(boundaryEvent.getId());

相关文章