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

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

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

Activity介绍

暂无

代码示例

代码示例来源:origin: Activiti/Activiti

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: Activiti/Activiti

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())) {
    
     addError(errors, Problems.MULTI_INSTANCE_MISSING_COLLECTION, process, activity,
        "Either loopCardinality or loopDataInputRef/activiti:collection must been set");
  }
  }
}

代码示例来源:origin: Activiti/Activiti

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: Activiti/Activiti

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: Activiti/Activiti

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

代码示例来源:origin: Activiti/Activiti

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()));
          activity.isAsynchronous());
propertiesNode.put(PROPERTY_EXCLUSIVE,
          !activity.isNotExclusive());
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,
if (CollectionUtils.isNotEmpty(activity.getDataOutputAssociations())) {
  for (DataAssociation dataAssociation : activity.getDataOutputAssociations()) {
    if (model.getFlowElement(dataAssociation.getTargetRef()) != null) {
      createDataAssociation(dataAssociation,

代码示例来源:origin: Activiti/Activiti

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) {
if (childExecutions != null) {
 for (ExecutionEntity childExecution : childExecutions) {
  if (activity.getId().equals(childExecution.getCurrentActivityId())) {
   callActivityExecutionIds.add(childExecution.getId());
  if (StringUtils.isNotEmpty(childExecution.getSuperExecutionId())
    && callActivityExecutionIds.contains(childExecution.getSuperExecutionId())) {
   executionEntityManager.deleteProcessInstanceExecutionEntity(childExecution.getId(), activity.getId(),
     "call activity completion condition met", true, false);

代码示例来源:origin: Activiti/Activiti

protected void createMultiInstanceLoopCharacteristics(BpmnParse bpmnParse, Activity modelActivity) {
 MultiInstanceLoopCharacteristics loopCharacteristics = modelActivity.getLoopCharacteristics();
  miActivityBehavior = bpmnParse.getActivityBehaviorFactory().createSequentialMultiInstanceBehavior(modelActivity, (AbstractBpmnActivityBehavior) modelActivity.getBehavior());
 } else {
  miActivityBehavior = bpmnParse.getActivityBehaviorFactory().createParallelMultiInstanceBehavior(modelActivity, (AbstractBpmnActivityBehavior) modelActivity.getBehavior());
 modelActivity.setBehavior(miActivityBehavior);
 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: Activiti/Activiti

public static void writeMultiInstance(Activity activity, XMLStreamWriter xtw) throws Exception {
  if (activity.getLoopCharacteristics() != null) {
   MultiInstanceLoopCharacteristics multiInstanceObject = activity.getLoopCharacteristics();
   if (StringUtils.isNotEmpty(multiInstanceObject.getLoopCardinality()) || StringUtils.isNotEmpty(multiInstanceObject.getInputDataItem())
     || StringUtils.isNotEmpty(multiInstanceObject.getCompletionCondition())) {

    xtw.writeStartElement(ELEMENT_MULTIINSTANCE);
    BpmnXMLUtil.writeDefaultAttribute(ATTRIBUTE_MULTIINSTANCE_SEQUENTIAL, String.valueOf(multiInstanceObject.isSequential()).toLowerCase(), xtw);
    if (StringUtils.isNotEmpty(multiInstanceObject.getInputDataItem())) {
     BpmnXMLUtil.writeQualifiedAttribute(ATTRIBUTE_MULTIINSTANCE_COLLECTION, multiInstanceObject.getInputDataItem(), xtw);
    }
    if (StringUtils.isNotEmpty(multiInstanceObject.getElementVariable())) {
     BpmnXMLUtil.writeQualifiedAttribute(ATTRIBUTE_MULTIINSTANCE_VARIABLE, multiInstanceObject.getElementVariable(), xtw);
    }
    if (StringUtils.isNotEmpty(multiInstanceObject.getLoopCardinality())) {
     xtw.writeStartElement(ELEMENT_MULTIINSTANCE_CARDINALITY);
     xtw.writeCharacters(multiInstanceObject.getLoopCardinality());
     xtw.writeEndElement();
    }
    if (StringUtils.isNotEmpty(multiInstanceObject.getCompletionCondition())) {
     xtw.writeStartElement(ELEMENT_MULTIINSTANCE_CONDITION);
     xtw.writeCharacters(multiInstanceObject.getCompletionCondition());
     xtw.writeEndElement();
    }
    xtw.writeEndElement();
   }
  }
 }
}

代码示例来源:origin: Activiti/Activiti

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: Activiti/Activiti

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(),
    if (StringUtils.isNotEmpty(messageEventDef.getMessageRef())) {
      if (bpmnModel.getMessage(messageEventDef.getMessageRef()) == null) {
        bpmnModel.addMessage(new Message(messageEventDef.getMessageRef(),
} 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: Activiti/Activiti

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()) == false && activity.getId().equals(miChildExecution.getCurrentActivityId())) {
    executionEntityManager.deleteExecutionAndRelatedData(miChildExecution, deleteReason, false);

代码示例来源:origin: Activiti/Activiti

if (flowNode instanceof Activity) {
  Activity activity = (Activity) flowNode;
  MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = activity.getLoopCharacteristics();
  if (multiInstanceLoopCharacteristics != null) {
    multiInstanceSequential = multiInstanceLoopCharacteristics.isSequential();
String defaultFlow = null;
if (flowNode instanceof Activity) {
  defaultFlow = ((Activity) flowNode).getDefaultFlow();
} else if (flowNode instanceof Gateway) {
  defaultFlow = ((Gateway) flowNode).getDefaultFlow();

代码示例来源:origin: Activiti/Activiti

@Override
public void parse(BpmnParse bpmnParse, BaseElement element) {
 super.parse(bpmnParse, element);
 if (element instanceof Activity && ((Activity) element).getLoopCharacteristics() != null) {
  createMultiInstanceLoopCharacteristics(bpmnParse, (Activity) element);
 }
}

代码示例来源:origin: stackoverflow.com

@Override
public void onLocationChanged(Location location) {
  longitude = location.getLongitude();
  latitude = location.getLatitude();
  Log.i("", "Latitude: " + latitude);
  Log.i("", "Longitude: " + longitude);
  if(activities != null) {
    for (Activity activity : activities) {
      Location newLocation = new Location(provider);
      newLocation.setLongitude(activity.getLongitude());
      newLocation.setLatitude(activity.getLatitude());

      if(location.distanceTo(newLocation) > 15 && activity.isInProximity()) {
        activity.setInProximity(false);
        stopTimer(activity.getId());
      }
      else if (location.distanceTo(newLocation) <= 15 && !activity.isInProximity()) {
        activity.setInProximity(true);
        startTimer(activity.getId());
      }
    }
  }
}

代码示例来源:origin: Activiti/Activiti

if (targetElement instanceof Activity) {
 Activity activity = (Activity) targetElement;
 if (activity.isForCompensation()) {
  compensationActivity = activity;
  break;
 scopeExecution, compensationActivity.getId());

代码示例来源:origin: com.bbossgroups.activiti/activiti-bpmn-converter

if (activity.isAsynchronous()) {
 writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, ATTRIBUTE_VALUE_TRUE, xtw);
if (activity.isNotExclusive()) {
 writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_EXCLUSIVE, ATTRIBUTE_VALUE_FALSE, xtw);
writeDefaultAttribute(ATTRIBUTE_DEFAULT, activity.getDefaultFlow(), xtw);

代码示例来源:origin: Activiti/Activiti

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
    Context.getAgenda().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<String>();
      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 = commandContext.getExecutionEntityManager().findChildExecutionsByParentExecutionId(execution.getId());
      for (ExecutionEntity childExecution : childExecutions) {
        if (childExecution.getCurrentFlowElement() == null || !notToDeleteEvents.contains(childExecution.getCurrentFlowElement().getId())) {
          commandContext.getExecutionEntityManager().deleteExecutionAndRelatedData(childExecution,
                                               null,
                                               false);
        }
      }
    }
  }
}

代码示例来源:origin: com.bbossgroups.activiti/activiti-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: com.bbossgroups.activiti/activiti-bpmn-converter

activity.setAsynchronous(async);
activity.setNotExclusive(notExclusive);
activity.setForCompensation(isForCompensation);
if(StringUtils.isNotEmpty(defaultFlow)) {
 activity.setDefaultFlow(defaultFlow);

相关文章