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

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

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

Association.getSourceRef介绍

暂无

代码示例

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

protected List<Association> findAssociationsWithSourceRefRecursive(FlowElementsContainer flowElementsContainer, String sourceRef) {
  List<Association> associations = new ArrayList<>();
  for (Artifact artifact : flowElementsContainer.getArtifacts()) {
    if (artifact instanceof Association) {
      Association association = (Association) artifact;
      if (association.getSourceRef() != null && association.getTargetRef() != null && association.getSourceRef().equals(sourceRef)) {
        associations.add(association);
      }
    }
  }
  for (FlowElement flowElement : flowElementsContainer.getFlowElements()) {
    if (flowElement instanceof FlowElementsContainer) {
      associations.addAll(findAssociationsWithSourceRefRecursive((FlowElementsContainer) flowElement, sourceRef));
    }
  }
  return associations;
}

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

protected List<Association> findAssociationsWithSourceRefRecursive(FlowElementsContainer flowElementsContainer, String sourceRef) {
  List<Association> associations = new ArrayList<>();
  for (Artifact artifact : flowElementsContainer.getArtifacts()) {
    if (artifact instanceof Association) {
      Association association = (Association) artifact;
      if (association.getSourceRef() != null && association.getTargetRef() != null && association.getSourceRef().equals(sourceRef)) {
        associations.add(association);
      }
    }
  }
  for (FlowElement flowElement : flowElementsContainer.getFlowElements()) {
    if (flowElement instanceof FlowElementsContainer) {
      associations.addAll(findAssociationsWithSourceRefRecursive((FlowElementsContainer) flowElement, sourceRef));
    }
  }
  return associations;
}

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

protected void validate(Process process, Association association, List<ValidationError> errors) {
  if (StringUtils.isEmpty(association.getSourceRef())) {
    addError(errors, Problems.ASSOCIATION_INVALID_SOURCE_REFERENCE, process, association, "association element missing attribute 'sourceRef'");
  }
  if (StringUtils.isEmpty(association.getTargetRef())) {
    addError(errors, Problems.ASSOCIATION_INVALID_TARGET_REFERENCE, process, association, "association element missing attribute 'targetRef'");
  }
}

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

protected void handleAssociations() {
  Hashtable<String, Object> edgeStyle = new Hashtable<>();
  edgeStyle.put(mxConstants.STYLE_ORTHOGONAL, true);
  edgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.ElbowConnector);
  edgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.0);
  edgeStyle.put(mxConstants.STYLE_ENTRY_Y, 0.5);
  graph.getStylesheet().putCellStyle(STYLE_SEQUENCEFLOW, edgeStyle);
  Hashtable<String, Object> boundaryEdgeStyle = new Hashtable<>();
  boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_X, 0.5);
  boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_Y, 1.0);
  boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.5);
  boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_Y, 1.0);
  boundaryEdgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.orthConnector);
  graph.getStylesheet().putCellStyle(STYLE_BOUNDARY_SEQUENCEFLOW, boundaryEdgeStyle);
  for (Association association : associations.values()) {
    Object sourceVertex = generatedVertices.get(association.getSourceRef());
    Object targetVertex = generatedVertices.get(association.getTargetRef());
    String style = null;
    if (handledFlowElements.get(association.getSourceRef()) instanceof BoundaryEvent) {
      // Sequence flow out of boundary events are handled in a different way,
      // to make them visually appealing for the eye of the dear end user.
      style = STYLE_BOUNDARY_SEQUENCEFLOW;
    } else {
      style = STYLE_SEQUENCEFLOW;
    }
    Object associationEdge = graph.insertEdge(cellParent, association.getId(), "", sourceVertex, targetVertex, style);
    generatedAssociationEdges.put(association.getId(), associationEdge);
  }
}

代码示例来源:origin: org.flowable/flowable-ui-task-rest

protected void processArtifacts(Collection<Artifact> artifactList, BpmnModel model, ArrayNode elementArray, ArrayNode flowArray, GraphicInfo diagramInfo) {
  for (Artifact artifact : artifactList) {
    if (artifact instanceof Association) {
      ObjectNode elementNode = objectMapper.createObjectNode();
      Association flow = (Association) artifact;
      elementNode.put("id", flow.getId());
      elementNode.put("type", "association");
      elementNode.put("sourceRef", flow.getSourceRef());
      elementNode.put("targetRef", flow.getTargetRef());
      fillWaypoints(flow.getId(), model, elementNode, diagramInfo);
      flowArray.add(elementNode);
    } else {
      ObjectNode elementNode = objectMapper.createObjectNode();
      elementNode.put("id", artifact.getId());
      if (artifact instanceof TextAnnotation) {
        TextAnnotation annotation = (TextAnnotation) artifact;
        elementNode.put("text", annotation.getText());
      }
      GraphicInfo graphicInfo = model.getGraphicInfo(artifact.getId());
      if (graphicInfo != null) {
        fillGraphicInfo(elementNode, graphicInfo, true);
        fillDiagramInfo(graphicInfo, diagramInfo);
      }
      String className = artifact.getClass().getSimpleName();
      elementNode.put("type", className);
      elementArray.add(elementNode);
    }
  }
}

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

ArrayNode dockersArrayNode = objectMapper.createArrayNode();
ObjectNode dockNode = objectMapper.createObjectNode();
dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(association.getSourceRef()).getWidth() / 2.0);
dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(association.getSourceRef()).getHeight() / 2.0);
dockersArrayNode.add(dockNode);

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

@Override
protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
  Association association = (Association) element;
  writeDefaultAttribute(ATTRIBUTE_FLOW_SOURCE_REF, association.getSourceRef(), xtw);
  writeDefaultAttribute(ATTRIBUTE_FLOW_TARGET_REF, association.getTargetRef(), xtw);
  AssociationDirection associationDirection = association.getAssociationDirection();
  if (associationDirection != null) {
    writeDefaultAttribute(ATTRIBUTE_ASSOCIATION_DIRECTION, associationDirection.getValue(), xtw);
  }
}

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

protected void createAssociation(BpmnParse bpmnParse, Association association) {
  BpmnModel bpmnModel = bpmnParse.getBpmnModel();
  if (bpmnModel.getArtifact(association.getSourceRef()) != null || bpmnModel.getArtifact(association.getTargetRef()) != null) {

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

public void setValues(Association otherElement) {
    super.setValues(otherElement);
    setSourceRef(otherElement.getSourceRef());
    setTargetRef(otherElement.getTargetRef());

    if (otherElement.getAssociationDirection() != null) {
      setAssociationDirection(otherElement.getAssociationDirection());
    }
  }
}

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

protected void createAssociation(BpmnParse bpmnParse, Association association, ScopeImpl parentScope) {
  BpmnModel bpmnModel = bpmnParse.getBpmnModel();
  if (bpmnModel.getArtifact(association.getSourceRef()) != null ||
      bpmnModel.getArtifact(association.getTargetRef()) != null) {
    // connected to a text annotation so skipping it
    return;
  }
  ActivityImpl sourceActivity = parentScope.findActivity(association.getSourceRef());
  ActivityImpl targetActivity = parentScope.findActivity(association.getTargetRef());
  // an association may reference elements that are not parsed as activities (like for instance
  // text annotations so do not throw an exception if sourceActivity or targetActivity are null)
  // However, we make sure they reference 'something':
  if (sourceActivity == null) {
    // bpmnModel.addProblem("Invalid reference sourceRef '" + association.getSourceRef() + "' of association element ", association.getId());
  } else if (targetActivity == null) {
    // bpmnModel.addProblem("Invalid reference targetRef '" + association.getTargetRef() + "' of association element ", association.getId());
  } else {
    if (sourceActivity.getProperty("type").equals("compensationBoundaryCatch")) {
      Object isForCompensation = targetActivity.getProperty(PROPERTYNAME_IS_FOR_COMPENSATION);
      if (isForCompensation == null || !(Boolean) isForCompensation) {
        LOGGER.warn("compensation boundary catch must be connected to element with isForCompensation=true");
      } else {
        ActivityImpl compensatedActivity = sourceActivity.getParentActivity();
        compensatedActivity.setProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID, targetActivity.getId());
      }
    }
  }
}

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

public void setValues(Association otherElement) {
    super.setValues(otherElement);
    setSourceRef(otherElement.getSourceRef());
    setTargetRef(otherElement.getTargetRef());

    if (otherElement.getAssociationDirection() != null) {
      setAssociationDirection(otherElement.getAssociationDirection());
    }
  }
}

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

if (artifact instanceof  Association){
    Association association= (Association) artifact;
    if (association.getSourceRef().equals(flowNode.getId())){
      outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(artifact.getId()));
if (artifact instanceof Association) {
  Association association = (Association) artifact;
  if (StringUtils.isNotEmpty(association.getSourceRef()) && association.getSourceRef().equals(baseElement.getId())) {
    outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(association.getId()));

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

List<Association> associations = process.findAssociationsWithTargetRefRecursive(activity.getId());
for (Association association : associations) {
  FlowElement sourceElement = process.getFlowElement(association.getSourceRef(), true);
  if (sourceElement instanceof BoundaryEvent) {
    BoundaryEvent sourceBoundaryEvent = (BoundaryEvent) sourceElement;

相关文章