org.flowable.bpmn.model.Activity类的使用及代码示例

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

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

Activity介绍

暂无

代码示例

代码示例来源: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-engine

protected void verifyCallActivity(ExecutionEntity executionToUse, Activity activity) {
  if (activity instanceof CallActivity) {
    ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager();
    if (executionToUse != null) {
      List<String> callActivityExecutionIds = new ArrayList<>();
      // Find all execution entities that are at the call activity
      List<ExecutionEntity> childExecutions = executionEntityManager.collectChildren(executionToUse);
      if (childExecutions != null) {
        for (ExecutionEntity childExecution : childExecutions) {
          if (activity.getId().equals(childExecution.getCurrentActivityId())) {
            callActivityExecutionIds.add(childExecution.getId());
          }
        }
        // Now all call activity executions have been collected, loop again and check which should be removed
        for (int i = childExecutions.size() - 1; i >= 0; i--) {
          ExecutionEntity childExecution = childExecutions.get(i);
          if (StringUtils.isNotEmpty(childExecution.getSuperExecutionId())
              && callActivityExecutionIds.contains(childExecution.getSuperExecutionId())) {
            executionEntityManager.deleteProcessInstanceExecutionEntity(childExecution.getId(), activity.getId(),
                "call activity completion condition met", true, false, true);
          }
        }
      }
    }
  }
}

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

protected Optional<String> getFlowElementMultiInstanceParentId(FlowElement flowElement) {
  FlowElementsContainer parentContainer = flowElement.getParentContainer();
  while (parentContainer instanceof Activity) {
    if (isFlowElementMultiInstance((Activity) parentContainer)) {
      return Optional.of(((Activity) parentContainer).getId());
    }
    parentContainer = ((Activity) parentContainer).getParentContainer();
  }
  return Optional.empty();
}

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

protected void handleDataAssociations(Process process, Activity activity, List<ValidationError> errors) {
  if (activity.getDataInputAssociations() != null) {
    for (DataAssociation dataAssociation : activity.getDataInputAssociations()) {
      if (StringUtils.isEmpty(dataAssociation.getTargetRef())) {
        addError(errors, Problems.DATA_ASSOCIATION_MISSING_TARGETREF, process, activity,
            "Targetref is required on a data association");
      }
    }
  }
  if (activity.getDataOutputAssociations() != null) {
    for (DataAssociation dataAssociation : activity.getDataOutputAssociations()) {
      if (StringUtils.isEmpty(dataAssociation.getTargetRef())) {
        addError(errors, Problems.DATA_ASSOCIATION_MISSING_TARGETREF, process, activity,
            "Targetref is required on a data association");
      }
    }
  }
}

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

protected void handleMultiInstanceLoopCharacteristics(Process process, Activity activity, List<ValidationError> errors) {
  MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = activity.getLoopCharacteristics();
  if (multiInstanceLoopCharacteristics != null) {
    if (StringUtils.isEmpty(multiInstanceLoopCharacteristics.getLoopCardinality())
        && StringUtils.isEmpty(multiInstanceLoopCharacteristics.getInputDataItem()) && StringUtils.isEmpty(multiInstanceLoopCharacteristics.getCollectionString())) {
      addError(errors, Problems.MULTI_INSTANCE_MISSING_COLLECTION, process, activity,
          "Either loopCardinality or loopDataInputRef/flowable:collection must been set");
    }
    
    if (!StringUtils.isEmpty(multiInstanceLoopCharacteristics.getCollectionString())) {
      if (multiInstanceLoopCharacteristics.getHandler() == null) {
        // verify string parsing function attributes
        addError(errors, Problems.MULTI_INSTANCE_MISSING_COLLECTION_FUNCTION_PARAMETERS, process, activity,
            "The flowable:collection element string value requires the function parameters flowable:delegateExpression or flowable:class.");
      }
    }
  }
}

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

activity.setForCompensation(isForCompensation);
if (StringUtils.isNotEmpty(defaultFlow)) {
  activity.setDefaultFlow(defaultFlow);
if (StringUtils.isNotEmpty(defaultFlow)) {
  gateway.setDefaultFlow(defaultFlow);

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

public static void writeMultiInstance(Activity activity, BpmnModel model, XMLStreamWriter xtw) throws Exception {
  if (activity.getLoopCharacteristics() != null) {
    MultiInstanceLoopCharacteristics multiInstanceObject = activity.getLoopCharacteristics();
    CollectionHandler handler = multiInstanceObject.getHandler();
    boolean didWriteExtensionStartElement = false;
    if (StringUtils.isNotEmpty(multiInstanceObject.getLoopCardinality()) || StringUtils.isNotEmpty(multiInstanceObject.getInputDataItem())
        || StringUtils.isNotEmpty(multiInstanceObject.getCompletionCondition()) || StringUtils.isNotEmpty(multiInstanceObject.getCollectionString())) {

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

if (StringUtils.isNotEmpty(flowElement.getName())) {
  propertiesNode.put(PROPERTY_NAME, flowElement.getName());
if (StringUtils.isNotEmpty(flowElement.getDocumentation())) {
  propertiesNode.put(PROPERTY_DOCUMENTATION, flowElement.getDocumentation());
for (BoundaryEvent boundaryEvent : activity.getBoundaryEvents()) {
  outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(boundaryEvent.getId()));
propertiesNode.put(PROPERTY_ASYNCHRONOUS, activity.isAsynchronous());
propertiesNode.put(PROPERTY_EXCLUSIVE, !activity.isNotExclusive());
propertiesNode.put(PROPERTY_FOR_COMPENSATION,activity.isForCompensation());
if (activity.getLoopCharacteristics() != null) {
  MultiInstanceLoopCharacteristics loopDef = activity.getLoopCharacteristics();
  if (StringUtils.isNotEmpty(loopDef.getLoopCardinality()) || StringUtils.isNotEmpty(loopDef.getInputDataItem()) || StringUtils.isNotEmpty(loopDef.getCompletionCondition())) {
if (CollectionUtils.isNotEmpty(activity.getDataInputAssociations())) {
  for (DataAssociation dataAssociation : activity.getDataInputAssociations()) {
    if (model.getFlowElement(dataAssociation.getSourceRef()) != null) {
      createDataAssociation(dataAssociation, true, activity);
if (CollectionUtils.isNotEmpty(activity.getDataOutputAssociations())) {
  for (DataAssociation dataAssociation : activity.getDataOutputAssociations()) {
    if (model.getFlowElement(dataAssociation.getTargetRef()) != null) {
      createDataAssociation(dataAssociation, false, activity);

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

if (activity.isForCompensation()) {
    writeDefaultAttribute(ATTRIBUTE_ACTIVITY_ISFORCOMPENSATION, ATTRIBUTE_VALUE_TRUE, xtw);
  if (StringUtils.isNotEmpty(activity.getDefaultFlow())) {
    FlowElement defaultFlowElement = model.getFlowElement(activity.getDefaultFlow());
    if (defaultFlowElement instanceof SequenceFlow) {
      writeDefaultAttribute(ATTRIBUTE_DEFAULT, activity.getDefaultFlow(), xtw);
  if (StringUtils.isNotEmpty(gateway.getDefaultFlow())) {
    FlowElement defaultFlowElement = model.getFlowElement(gateway.getDefaultFlow());
    if (defaultFlowElement instanceof SequenceFlow) {
if (StringUtils.isNotEmpty(flowElement.getDocumentation())) {

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

if (StringUtils.isNotEmpty(sequenceFlow.getName())) {
  propertiesNode.put(PROPERTY_NAME, sequenceFlow.getName());
if (StringUtils.isNotEmpty(sequenceFlow.getDocumentation())) {
  propertiesNode.put(PROPERTY_DOCUMENTATION, sequenceFlow.getDocumentation());
if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) {
  propertiesNode.put(PROPERTY_SEQUENCEFLOW_CONDITION, sequenceFlow.getConditionExpression());
    } else if (sourceFlowElement instanceof Activity) {
      Activity parentActivity = (Activity) sourceFlowElement;
      defaultFlowId = parentActivity.getDefaultFlow();

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

if (eventDef instanceof SignalEventDefinition) {
    SignalEventDefinition signalEventDef = (SignalEventDefinition) eventDef;
    if (StringUtils.isNotEmpty(signalEventDef.getSignalRef())) {
      if (bpmnModel.getSignal(signalEventDef.getSignalRef()) == null) {
        bpmnModel.addSignal(new Signal(signalEventDef.getSignalRef(), signalEventDef.getSignalRef()));
    if (StringUtils.isNotEmpty(messageEventDef.getMessageRef())) {
      if (bpmnModel.getMessage(messageEventDef.getMessageRef()) == null) {
        bpmnModel.addMessage(new Message(messageEventDef.getMessageRef(), messageEventDef.getMessageRef(), null));
} else {
  boundaryEvent.setAttachedToRef(activity);
  activity.getBoundaryEvents().add(boundaryEvent);
    if (isDefault) {
      if (sourceFlowElement instanceof Activity) {
        ((Activity) sourceFlowElement).setDefaultFlow(sequenceFlow.getId());
      } else if (sourceFlowElement instanceof Gateway) {
        ((Gateway) sourceFlowElement).setDefaultFlow(sequenceFlow.getId());

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

protected void createMultiInstanceLoopCharacteristics(BpmnParse bpmnParse, Activity modelActivity) {
  MultiInstanceLoopCharacteristics loopCharacteristics = modelActivity.getLoopCharacteristics();
  modelActivity.setBehavior(miActivityBehavior);
  if (StringUtils.isNotEmpty(loopCharacteristics.getLoopCardinality())) {
    miActivityBehavior.setLoopCardinalityExpression(expressionManager.createExpression(loopCharacteristics.getLoopCardinality()));
  if (StringUtils.isNotEmpty(loopCharacteristics.getCompletionCondition())) {
    miActivityBehavior.setCompletionCondition(loopCharacteristics.getCompletionCondition());
  if (StringUtils.isNotEmpty(loopCharacteristics.getInputDataItem())) {
    miActivityBehavior.setCollectionExpression(expressionManager.createExpression(loopCharacteristics.getInputDataItem()));

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

protected void createMultiInstanceLoopCharacteristics(BpmnParse bpmnParse, Activity modelActivity) {
  MultiInstanceLoopCharacteristics loopCharacteristics = modelActivity.getLoopCharacteristics();
  ActivityImpl activity = bpmnParse.getCurrentScope().findActivity(modelActivity.getId());
  if (activity == null) {
    throw new ActivitiException("Activity " + modelActivity.getId() + " needed for multi instance cannot bv found");
  if (StringUtils.isNotEmpty(loopCharacteristics.getLoopCardinality())) {
    miActivityBehavior.setLoopCardinalityExpression(expressionManager.createExpression(loopCharacteristics.getLoopCardinality()));
  if (StringUtils.isNotEmpty(loopCharacteristics.getCompletionCondition())) {
    miActivityBehavior.setCompletionConditionExpression(expressionManager.createExpression(loopCharacteristics.getCompletionCondition()));
  if (StringUtils.isNotEmpty(loopCharacteristics.getInputDataItem())) {
    if (loopCharacteristics.getInputDataItem().contains("{")) {
      miActivityBehavior.setCollectionExpression(expressionManager.createExpression(loopCharacteristics.getInputDataItem()));

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

if (StringUtils.isNotEmpty(activityRef)) {
    if (flowElement instanceof Activity) {
      Activity activity = (Activity) flowElement;
      if (activity.isForCompensation()) {
        List<Association> associations = process.findAssociationsWithTargetRefRecursive(activity.getId());
        for (Association association : associations) {
          FlowElement sourceElement = process.getFlowElement(association.getSourceRef(), true);

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

activity.setAsynchronous(getPropertyValueAsBoolean(PROPERTY_ASYNCHRONOUS, elementNode));
activity.setNotExclusive(!getPropertyValueAsBoolean(PROPERTY_EXCLUSIVE, elementNode));
activity.setForCompensation(getPropertyValueAsBoolean(PROPERTY_FOR_COMPENSATION, elementNode));
String multiInstanceType = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_TYPE, elementNode);
String multiInstanceCardinality = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_CARDINALITY, elementNode);
String multiInstanceCondition = getPropertyValueAsString(PROPERTY_MULTIINSTANCE_CONDITION, elementNode);
if (StringUtils.isNotEmpty(multiInstanceType) && !"none".equalsIgnoreCase(multiInstanceType)) {
  multiInstanceObject.setElementVariable(multiInstanceVariable);
  multiInstanceObject.setCompletionCondition(multiInstanceCondition);
  activity.setLoopCharacteristics(multiInstanceObject);

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

protected boolean isFlowElementMultiInstance(FlowElement flowElement) {
  if (flowElement instanceof Activity) {
    return ((Activity) flowElement).getLoopCharacteristics() != null;
  }
  return false;
}

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

protected void handleConstraints(Process process, Activity activity, List<ValidationError> errors) {
  if (activity.getId() != null && activity.getId().length() > ID_MAX_LENGTH) {
    addError(errors, Problems.FLOW_ELEMENT_ID_TOO_LONG, process, activity,
        "The id of a flow element must not contain more than " + ID_MAX_LENGTH + " characters");
  }
}

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

if (subProcessExecution.getCurrentFlowElement() instanceof Activity) {
  Activity activity = (Activity) subProcessExecution.getCurrentFlowElement();
  if (activity.getLoopCharacteristics() != null) {
    ExecutionEntity miExecution = subProcessExecution.getParent();
    List<ExecutionEntity> miChildExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(miExecution.getId());
    for (ExecutionEntity miChildExecution : miChildExecutions) {
      if (!subProcessExecution.getId().equals(miChildExecution.getId()) && activity.getId().equals(miChildExecution.getCurrentActivityId())) {
        executionEntityManager.deleteExecutionAndRelatedData(miChildExecution, deleteReason, false);

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

public ActivityImpl createActivityOnScope(BpmnParse bpmnParse, FlowElement flowElement, String xmlLocalName, ScopeImpl scopeElement) {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Parsing activity {}", flowElement.getId());
  }
  ActivityImpl activity = scopeElement.createActivity(flowElement.getId());
  bpmnParse.setCurrentActivity(activity);
  activity.setProperty("name", flowElement.getName());
  activity.setProperty("documentation", flowElement.getDocumentation());
  if (flowElement instanceof Activity) {
    Activity modelActivity = (Activity) flowElement;
    activity.setProperty("default", modelActivity.getDefaultFlow());
    if (modelActivity.isForCompensation()) {
      activity.setProperty(PROPERTYNAME_IS_FOR_COMPENSATION, true);
    }
  } else if (flowElement instanceof Gateway) {
    activity.setProperty("default", ((Gateway) flowElement).getDefaultFlow());
  }
  activity.setProperty("type", xmlLocalName);
  return activity;
}

代码示例来源: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;
}

相关文章