json.converter

news2024/11/20 9:32:55

爬虫组件分析

  • 目录
    • 概述
      • 需求:
    • 设计思路
    • 实现思路分析
      • 1.ActivityProcessor
      • 2.AssociationJsonConverter
      • 3.BaseBpmnJsonConverter
      • 4.BoundaryEventJsonConverter
      • 5.BpmnJsonConverter
    • 拓展实现
  • 参考资料和推荐阅读

Survive by day and develop by night.
talk for import biz , show your perfect code,full busy,skip hardness,make a better result,wait for change,challenge Survive.
happy for hardess to solve denpendies.

目录

在这里插入图片描述

概述

ActivityProcessor的是一个非常常见的需求。

需求:

设计思路

实现思路分析

1.ActivityProcessor

public interface ActivityProcessor {

  public void processFlowElements(FlowElementsContainer container, BpmnModel model, ArrayNode shapesArrayNode,
      Map<String, ModelInfo> formKeyMap, Map<String, ModelInfo> decisionTableKeyMap, double subProcessX, double subProcessY);

  public void processJsonElements(JsonNode shapesArrayNode, JsonNode modelNode, BaseElement parentElement,
      Map<String, JsonNode> shapeMap, Map<String, String> formKeyMap, Map<String, String> decisionTableMap, BpmnModel bpmnModel);
}

2.AssociationJsonConverter

@Override
  public void convertToJson(BaseElement baseElement, ActivityProcessor processor, BpmnModel model, FlowElementsContainer container, ArrayNode shapesArrayNode, double subProcessX, double subProcessY) {

    Association association = (Association) baseElement;
    ObjectNode flowNode = BpmnJsonConverterUtil.createChildShape(association.getId(), STENCIL_ASSOCIATION, 172, 212, 128, 212);
    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);

    List<GraphicInfo> graphicInfoList = model.getFlowLocationGraphicInfo(association.getId());
    if (graphicInfoList.size() > 2) {
      for (int i = 1; i < graphicInfoList.size() - 1; i++) {
        GraphicInfo graphicInfo = graphicInfoList.get(i);
        dockNode = objectMapper.createObjectNode();
        dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getX());
        dockNode.put(EDITOR_BOUNDS_Y, graphicInfo.getY());
        dockersArrayNode.add(dockNode);
      }
    }

    GraphicInfo targetGraphicInfo = model.getGraphicInfo(association.getTargetRef());
    GraphicInfo flowGraphicInfo = graphicInfoList.get(graphicInfoList.size() - 1);

    double diffTopY = Math.abs(flowGraphicInfo.getY() - targetGraphicInfo.getY());
    double diffRightX = Math.abs(flowGraphicInfo.getX() - (targetGraphicInfo.getX() + targetGraphicInfo.getWidth()));
    double diffBottomY = Math.abs(flowGraphicInfo.getY() - (targetGraphicInfo.getY() + targetGraphicInfo.getHeight()));

    dockNode = objectMapper.createObjectNode();
    if (diffTopY < 5) {
      dockNode.put(EDITOR_BOUNDS_X, targetGraphicInfo.getWidth() / 2.0);
      dockNode.put(EDITOR_BOUNDS_Y, 0.0);

    } else if (diffRightX < 5) {
      dockNode.put(EDITOR_BOUNDS_X, targetGraphicInfo.getWidth());
      dockNode.put(EDITOR_BOUNDS_Y, targetGraphicInfo.getHeight() / 2.0);

    } else if (diffBottomY < 5) {
      dockNode.put(EDITOR_BOUNDS_X, targetGraphicInfo.getWidth() / 2.0);
      dockNode.put(EDITOR_BOUNDS_Y, targetGraphicInfo.getHeight());

    } else {
      dockNode.put(EDITOR_BOUNDS_X, 0.0);
      dockNode.put(EDITOR_BOUNDS_Y, targetGraphicInfo.getHeight() / 2.0);
    }
    dockersArrayNode.add(dockNode);
    flowNode.set("dockers", dockersArrayNode);
    ArrayNode outgoingArrayNode = objectMapper.createArrayNode();
    outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(association.getTargetRef()));
    flowNode.set("outgoing", outgoingArrayNode);
    flowNode.set("target", BpmnJsonConverterUtil.createResourceNode(association.getTargetRef()));

    ObjectNode propertiesNode = objectMapper.createObjectNode();
    propertiesNode.put(PROPERTY_OVERRIDE_ID, association.getId());

    flowNode.set(EDITOR_SHAPE_PROPERTIES, propertiesNode);

    shapesArrayNode.add(flowNode);
  }

3.BaseBpmnJsonConverter

public abstract class BaseBpmnJsonConverter implements EditorJsonConstants,
                                                       StencilConstants {

    protected static final Logger LOGGER = LoggerFactory.getLogger(BaseBpmnJsonConverter.class);

    public static final String NAMESPACE = "http://activiti.com/modeler";

    protected ObjectMapper objectMapper = new ObjectMapper();
    protected ActivityProcessor processor;
    protected BpmnModel model;
    protected ObjectNode flowElementNode;
    protected double subProcessX;
    protected double subProcessY;
    protected ArrayNode shapesArrayNode;

    public void convertToJson(BaseElement baseElement,
                              ActivityProcessor processor,
                              BpmnModel model,
                              FlowElementsContainer container,
                              ArrayNode shapesArrayNode,
                              double subProcessX,
                              double subProcessY) {

        this.model = model;
        this.processor = processor;
        this.subProcessX = subProcessX;
        this.subProcessY = subProcessY;
        this.shapesArrayNode = shapesArrayNode;
        GraphicInfo graphicInfo = model.getGraphicInfo(baseElement.getId());

        String stencilId = null;
        if (baseElement instanceof ServiceTask) {
            ServiceTask serviceTask = (ServiceTask) baseElement;
            if ("mail".equalsIgnoreCase(serviceTask.getType())) {
                stencilId = STENCIL_TASK_MAIL;
            } else if ("camel".equalsIgnoreCase(serviceTask.getType())) {
                stencilId = STENCIL_TASK_CAMEL;
            } else if ("mule".equalsIgnoreCase(serviceTask.getType())) {
                stencilId = STENCIL_TASK_MULE;
            } else if ("dmn".equalsIgnoreCase(serviceTask.getType())) {
                stencilId = STENCIL_TASK_DECISION;
            } else {
                stencilId = getStencilId(baseElement);
            }
        } else {
            stencilId = getStencilId(baseElement);
        }

        flowElementNode = BpmnJsonConverterUtil.createChildShape(baseElement.getId(),
                                                                 stencilId,
                                                                 graphicInfo.getX() - subProcessX + graphicInfo.getWidth(),
                                                                 graphicInfo.getY() - subProcessY + graphicInfo.getHeight(),
                                                                 graphicInfo.getX() - subProcessX,
                                                                 graphicInfo.getY() - subProcessY);
        shapesArrayNode.add(flowElementNode);
        ObjectNode propertiesNode = objectMapper.createObjectNode();
        propertiesNode.put(PROPERTY_OVERRIDE_ID, baseElement.getId());

        if (baseElement instanceof FlowElement) {
            FlowElement flowElement = (FlowElement) baseElement;
            if (StringUtils.isNotEmpty(flowElement.getName())) {
                propertiesNode.put(PROPERTY_NAME, flowElement.getName());
            }

            if (StringUtils.isNotEmpty(flowElement.getDocumentation())) {
                propertiesNode.put(PROPERTY_DOCUMENTATION, flowElement.getDocumentation());
            }
        }

        convertElementToJson(propertiesNode, baseElement);

        flowElementNode.set(EDITOR_SHAPE_PROPERTIES, propertiesNode);
        ArrayNode outgoingArrayNode = objectMapper.createArrayNode();

        if (baseElement instanceof FlowNode) {
            FlowNode flowNode = (FlowNode) baseElement;
            for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) {
                outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(sequenceFlow.getId()));
            }

            for (MessageFlow messageFlow : model.getMessageFlows().values()) {
                if (messageFlow.getSourceRef().equals(flowNode.getId())) {
                    outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(messageFlow.getId()));
                }
            }
        }

        if (baseElement instanceof Activity) {

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

            propertiesNode.put(PROPERTY_ASYNCHRONOUS,
                               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 (!loopDef.isSequential()) {
                        propertiesNode.put(PROPERTY_MULTIINSTANCE_TYPE,
                                           "Parallel");
                    } else {
                        propertiesNode.put(PROPERTY_MULTIINSTANCE_TYPE,
                                           "Sequential");
                    }

                    if (StringUtils.isNotEmpty(loopDef.getLoopCardinality())) {
                        propertiesNode.put(PROPERTY_MULTIINSTANCE_CARDINALITY,
                                           loopDef.getLoopCardinality());
                    }
                    if (StringUtils.isNotEmpty(loopDef.getInputDataItem())) {
                        propertiesNode.put(PROPERTY_MULTIINSTANCE_COLLECTION,
                                           loopDef.getInputDataItem());
                    }
                    if (StringUtils.isNotEmpty(loopDef.getElementVariable())) {
                        propertiesNode.put(PROPERTY_MULTIINSTANCE_VARIABLE,
                                           loopDef.getElementVariable());
                    }
                    if (StringUtils.isNotEmpty(loopDef.getCompletionCondition())) {
                        propertiesNode.put(PROPERTY_MULTIINSTANCE_CONDITION,
                                           loopDef.getCompletionCondition());
                    }
                }
            }

            if (activity instanceof UserTask) {
                BpmnJsonConverterUtil.convertListenersToJson(((UserTask) activity).getTaskListeners(),
                                                             false,
                                                             propertiesNode);
            }

            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);
                        outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(dataAssociation.getId()));
                    }
                }
            }
        }

        if (baseElement instanceof FlowElement) {
            BpmnJsonConverterUtil.convertListenersToJson(((FlowElement) baseElement).getExecutionListeners(),
                                                         true,
                                                         propertiesNode);
        }

        for (Artifact artifact : container.getArtifacts()) {
            if (artifact instanceof Association) {
                Association association = (Association) artifact;
                if (StringUtils.isNotEmpty(association.getSourceRef()) && association.getSourceRef().equals(baseElement.getId())) {
                    outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(association.getId()));
                }
            }
        }

        if (baseElement instanceof DataStoreReference) {
            for (Process process : model.getProcesses()) {
                processDataStoreReferences(process,
                                           baseElement.getId(),
                                           outgoingArrayNode);
            }
        }

        flowElementNode.set("outgoing",
                            outgoingArrayNode);
    }

    protected void processDataStoreReferences(FlowElementsContainer container,
                                              String dataStoreReferenceId,
                                              ArrayNode outgoingArrayNode) {
        for (FlowElement flowElement : container.getFlowElements()) {
            if (flowElement instanceof Activity) {
                Activity activity = (Activity) flowElement;

                if (CollectionUtils.isNotEmpty(activity.getDataInputAssociations())) {
                    for (DataAssociation dataAssociation : activity.getDataInputAssociations()) {
                        if (dataStoreReferenceId.equals(dataAssociation.getSourceRef())) {
                            outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(dataAssociation.getId()));
                        }
                    }
                }
            } else if (flowElement instanceof SubProcess) {
                processDataStoreReferences((SubProcess) flowElement,
                                           dataStoreReferenceId,
                                           outgoingArrayNode);
            }
        }
    }

    protected void createDataAssociation(DataAssociation dataAssociation,
                                         boolean incoming,
                                         Activity activity) {
        String sourceRef = null;
        String targetRef = null;
        if (incoming) {
            sourceRef = dataAssociation.getSourceRef();
            targetRef = activity.getId();
        } else {
            sourceRef = activity.getId();
            targetRef = dataAssociation.getTargetRef();
        }

        ObjectNode flowNode = BpmnJsonConverterUtil.createChildShape(dataAssociation.getId(),
                                                                     STENCIL_DATA_ASSOCIATION,
                                                                     172,
                                                                     212,
                                                                     128,
                                                                     212);
        ArrayNode dockersArrayNode = objectMapper.createArrayNode();
        ObjectNode dockNode = objectMapper.createObjectNode();

        dockNode.put(EDITOR_BOUNDS_X,
                     model.getGraphicInfo(sourceRef).getWidth() / 2.0);
        dockNode.put(EDITOR_BOUNDS_Y,
                     model.getGraphicInfo(sourceRef).getHeight() / 2.0);
        dockersArrayNode.add(dockNode);

        if (model.getFlowLocationGraphicInfo(dataAssociation.getId()).size() > 2) {
            for (int i = 1; i < model.getFlowLocationGraphicInfo(dataAssociation.getId()).size() - 1; i++) {
                GraphicInfo graphicInfo = model.getFlowLocationGraphicInfo(dataAssociation.getId()).get(i);
                dockNode = objectMapper.createObjectNode();
                dockNode.put(EDITOR_BOUNDS_X,
                             graphicInfo.getX());
                dockNode.put(EDITOR_BOUNDS_Y,
                             graphicInfo.getY());
                dockersArrayNode.add(dockNode);
            }
        }

        dockNode = objectMapper.createObjectNode();
        dockNode.put(EDITOR_BOUNDS_X,
                     model.getGraphicInfo(targetRef).getWidth() / 2.0);
        dockNode.put(EDITOR_BOUNDS_Y,
                     model.getGraphicInfo(targetRef).getHeight() / 2.0);
        dockersArrayNode.add(dockNode);
        flowNode.set("dockers",
                     dockersArrayNode);
        ArrayNode outgoingArrayNode = objectMapper.createArrayNode();
        outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(targetRef));
        flowNode.set("outgoing",
                     outgoingArrayNode);
        flowNode.set("target",
                     BpmnJsonConverterUtil.createResourceNode(targetRef));

        ObjectNode propertiesNode = objectMapper.createObjectNode();
        propertiesNode.put(PROPERTY_OVERRIDE_ID,
                           dataAssociation.getId());

        flowNode.set(EDITOR_SHAPE_PROPERTIES,
                     propertiesNode);
        shapesArrayNode.add(flowNode);
    }

4.BoundaryEventJsonConverter

 public static void fillTypes(Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap,
      Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap) {

    fillJsonTypes(convertersToBpmnMap);
    fillBpmnTypes(convertersToJsonMap);
  }

  public static void fillJsonTypes(Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap) {
    convertersToBpmnMap.put(STENCIL_EVENT_BOUNDARY_TIMER, BoundaryEventJsonConverter.class);
    convertersToBpmnMap.put(STENCIL_EVENT_BOUNDARY_ERROR, BoundaryEventJsonConverter.class);
    convertersToBpmnMap.put(STENCIL_EVENT_BOUNDARY_SIGNAL, BoundaryEventJsonConverter.class);
    convertersToBpmnMap.put(STENCIL_EVENT_BOUNDARY_MESSAGE, BoundaryEventJsonConverter.class);
    convertersToBpmnMap.put(STENCIL_EVENT_BOUNDARY_CANCEL, BoundaryEventJsonConverter.class);
    convertersToBpmnMap.put(STENCIL_EVENT_BOUNDARY_COMPENSATION, BoundaryEventJsonConverter.class);
  }

  public static void fillBpmnTypes(Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap) {
    convertersToJsonMap.put(BoundaryEvent.class, BoundaryEventJsonConverter.class);
  }

  protected String getStencilId(BaseElement baseElement) {
    BoundaryEvent boundaryEvent = (BoundaryEvent) baseElement;
    List<EventDefinition> eventDefinitions = boundaryEvent.getEventDefinitions();
    if (eventDefinitions.size() != 1) {
      // return timer event as default;
      return STENCIL_EVENT_BOUNDARY_TIMER;
    }

    EventDefinition eventDefinition = eventDefinitions.get(0);
    if (eventDefinition instanceof ErrorEventDefinition) {
      return STENCIL_EVENT_BOUNDARY_ERROR;
    } else if (eventDefinition instanceof SignalEventDefinition) {
      return STENCIL_EVENT_BOUNDARY_SIGNAL;
    } else if (eventDefinition instanceof MessageEventDefinition) {
      return STENCIL_EVENT_BOUNDARY_MESSAGE;
    } else if (eventDefinition instanceof CancelEventDefinition) {
      return STENCIL_EVENT_BOUNDARY_CANCEL;
    } else if (eventDefinition instanceof CompensateEventDefinition) {
      return STENCIL_EVENT_BOUNDARY_COMPENSATION;
    } else {
      return STENCIL_EVENT_BOUNDARY_TIMER;
    }
  }

5.BpmnJsonConverter

public class BpmnJsonConverter implements EditorJsonConstants,
                                          StencilConstants,
                                          ActivityProcessor {

    protected static final Logger LOGGER = LoggerFactory.getLogger(BpmnJsonConverter.class);

    protected ObjectMapper objectMapper = new ObjectMapper();

    protected static Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap = new HashMap<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>>();
    protected static Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap = new HashMap<String, Class<? extends BaseBpmnJsonConverter>>();

    public final static String MODELER_NAMESPACE = "http://activiti.com/modeler";
    protected final static DateFormat defaultFormat = new SimpleDateFormat("yyyyMMddHHmmss");
    protected final static DateFormat entFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");

    static {

        // start and end events
        StartEventJsonConverter.fillTypes(convertersToBpmnMap,
                                          convertersToJsonMap);
        EndEventJsonConverter.fillTypes(convertersToBpmnMap,
                                        convertersToJsonMap);

        // connectors
        SequenceFlowJsonConverter.fillTypes(convertersToBpmnMap,
                                            convertersToJsonMap);
        MessageFlowJsonConverter.fillTypes(convertersToBpmnMap,
                                           convertersToJsonMap);
        AssociationJsonConverter.fillTypes(convertersToBpmnMap,
                                           convertersToJsonMap);

        // task types
        BusinessRuleTaskJsonConverter.fillTypes(convertersToBpmnMap,
                                                convertersToJsonMap);
        MailTaskJsonConverter.fillTypes(convertersToBpmnMap,
                                        convertersToJsonMap);
        ManualTaskJsonConverter.fillTypes(convertersToBpmnMap,
                                          convertersToJsonMap);
        ReceiveTaskJsonConverter.fillTypes(convertersToBpmnMap,
                                           convertersToJsonMap);
        ScriptTaskJsonConverter.fillTypes(convertersToBpmnMap,
                                          convertersToJsonMap);
        ServiceTaskJsonConverter.fillTypes(convertersToBpmnMap,
                                           convertersToJsonMap);
        UserTaskJsonConverter.fillTypes(convertersToBpmnMap,
                                        convertersToJsonMap);
        CallActivityJsonConverter.fillTypes(convertersToBpmnMap,
                                            convertersToJsonMap);
        CamelTaskJsonConverter.fillTypes(convertersToBpmnMap,
                                         convertersToJsonMap);
        MuleTaskJsonConverter.fillTypes(convertersToBpmnMap,
                                        convertersToJsonMap);
        SendTaskJsonConverter.fillTypes(convertersToBpmnMap,
                                        convertersToJsonMap);
        DecisionTaskJsonConverter.fillTypes(convertersToBpmnMap,
                                            convertersToJsonMap);

        // gateways
        ExclusiveGatewayJsonConverter.fillTypes(convertersToBpmnMap,
                                                convertersToJsonMap);
        InclusiveGatewayJsonConverter.fillTypes(convertersToBpmnMap,
                                                convertersToJsonMap);
        ParallelGatewayJsonConverter.fillTypes(convertersToBpmnMap,
                                               convertersToJsonMap);
        EventGatewayJsonConverter.fillTypes(convertersToBpmnMap,
                                            convertersToJsonMap);

        // scope constructs
        SubProcessJsonConverter.fillTypes(convertersToBpmnMap,
                                          convertersToJsonMap);
        EventSubProcessJsonConverter.fillTypes(convertersToBpmnMap,
                                               convertersToJsonMap);

        // catch events
        CatchEventJsonConverter.fillTypes(convertersToBpmnMap,
                                          convertersToJsonMap);

        // throw events
        ThrowEventJsonConverter.fillTypes(convertersToBpmnMap,
                                          convertersToJsonMap);

        // boundary events
        BoundaryEventJsonConverter.fillTypes(convertersToBpmnMap,
                                             convertersToJsonMap);

        // artifacts
        TextAnnotationJsonConverter.fillTypes(convertersToBpmnMap,
                                              convertersToJsonMap);
        DataStoreJsonConverter.fillTypes(convertersToBpmnMap,
                                         convertersToJsonMap);
    }

拓展实现

public static void convertListenersToJson(List<ActivitiListener> listeners, boolean isExecutionListener, ObjectNode propertiesNode) {
      String propertyName = null;
      String valueName = null;
      if (isExecutionListener) {
          propertyName = PROPERTY_EXECUTION_LISTENERS;
          valueName = "executionListeners";

      } else {
          propertyName = PROPERTY_TASK_LISTENERS;
          valueName = "taskListeners";
      }

      ObjectNode listenersNode = objectMapper.createObjectNode();
      ArrayNode itemsNode = objectMapper.createArrayNode();
      for (ActivitiListener listener : listeners) {
          ObjectNode propertyItemNode = objectMapper.createObjectNode();

          propertyItemNode.put(PROPERTY_LISTENER_EVENT, listener.getEvent());

          if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType())) {
              propertyItemNode.put(PROPERTY_LISTENER_CLASS_NAME, listener.getImplementation());
          } else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equals(listener.getImplementationType())) {
              propertyItemNode.put(PROPERTY_LISTENER_EXPRESSION, listener.getImplementation());
          } else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals(listener.getImplementationType())) {
              propertyItemNode.put(PROPERTY_LISTENER_DELEGATE_EXPRESSION, listener.getImplementation());
          }

          if (CollectionUtils.isNotEmpty(listener.getFieldExtensions())) {
              ArrayNode fieldsArray = objectMapper.createArrayNode();
              for (FieldExtension fieldExtension : listener.getFieldExtensions()) {
                  ObjectNode fieldNode = objectMapper.createObjectNode();
                  fieldNode.put(PROPERTY_FIELD_NAME, fieldExtension.getFieldName());
                  if (StringUtils.isNotEmpty(fieldExtension.getStringValue())) {
                      fieldNode.put(PROPERTY_FIELD_STRING_VALUE, fieldExtension.getStringValue());
                  }
                  if (StringUtils.isNotEmpty(fieldExtension.getExpression())) {
                      fieldNode.put(PROPERTY_FIELD_EXPRESSION, fieldExtension.getExpression());
                  }
                  fieldsArray.add(fieldNode);
              }
              propertyItemNode.set(PROPERTY_LISTENER_FIELDS, fieldsArray);
          }

          itemsNode.add(propertyItemNode);
      }

参考资料和推荐阅读

[1]. https://www.activiti.org/

欢迎阅读,各位老铁,如果对你有帮助,点个赞加个关注呗!~

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/10833.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【出人意料】一种基于Vue2监听器(watch)和定时器(setInterval)的轨迹播放方法实现方案

1、需求 数据库中有设备的经纬度记录&#xff0c;前端需要实现从数据库中取到数据后在地图上显示轨迹&#xff0c;显示轨迹的方式就是一个一个点地有序显示。点与点之间用线段连接&#xff0c;最终构成一条轨迹线。 2、场景过程 前端定义一个播放暂停按钮&#xff1b;点击播…

【Flutter】【package】auto_size_text 文字自动适配大小

文章目录前言一、auto_size_text 是什么&#xff1f;二、使用1.简单的使用2.参数说明3.group4.rich text总结前言 auto_size_text &#xff1a;https://pub.flutter-io.cn/packages/auto_size_text 一、auto_size_text 是什么&#xff1f; 第三方的插件&#xff0c;能够自动适…

DDD的落地,需要基础设施的大力支持

1. 概览 对于复杂业务&#xff0c;DDD 绝对是一把神器&#xff0c;由于它过于复杂&#xff0c;很多人望而却步。因为太过严谨&#xff0c;形成了很多设计模式、规范化流程&#xff0c;这些爆炸的信息已经成为 DDD 落地的重大阻力。 但&#xff0c;如果我们将这些规范化的流程…

1.4_28 Axure RP 9 for mac 高保真原型图 - 案例27【中继器 - 后台管理系统5】功能-弹窗修改数据

相关链接 目录Axure中文学习网AxureShopAxureShop-QA 案例目标1. 了解使用中继器&#xff0c;弹窗修改数据的实现方式 一、成品效果 Axure Cloud 案例27【中继器 - 后台管理系统5】功能-弹窗修改数据 版本更新一、修改功能   1.1 点击修改按钮&#xff0c;标记该条数据&am…

国产软件Bigemap与国产在线地图源<星图地球数据云>推动国内新GIS应用

自星图地球数据云(GEOVIS Earth Datacloud)图源成为国产基础软件Bigemap的在线地图数据服务平台之一以来&#xff0c;其日均地图瓦片请求调用量目前已经超过2亿。 “星图地球数据云"是中科星图(股票代码[688568])旗下子公司——星图地球倾力打造的在线时空数据云服务平台…

基于约束的装配设计【CadQuery】

本教程介绍在CadQuery中如何使用装配约束功能来构建逼真的模型&#xff0c;我们将组装一个由 20x20 V 型槽型材制成的门组件。 1、定义参数 我们希望从定义模型参数开始&#xff0c;以便以后可以轻松更改尺寸&#xff1a; import cadquery as cq# Parameters H 400 W 200…

2.8 高收藏率小红书笔记怎么写?试一试这7类方法吧【玩赚小红书】

1、教程攻略类 ​ ​ ​ 打开任何一类的美妆产品&#xff0c;最常见的就是各类妆容教程和变美攻略。就拿教程最多的眼妆来说吧&#xff0c;很多女孩子都觉得眼妆很难画好。 如果是碰到网上流行的网红眼影&#xff0c;比如什么猫眼妆、截断式眼影、桃花眼影等等。 【 高收藏秘…

社区团购小程序制作有什么优势_ 社区团购小程序的作用

打造属于自身的独立小程序拥有更高的自主性&#xff0c;特别是基于得店小程序的创新产品力&#xff0c;从设计上彰显品牌理念&#xff0c;到功能上进行扩展拓宽营销方式&#xff0c;都完全自我掌控&#xff0c; ● 更重要的是&#xff0c;相比于平台上各种复杂的机制&#xff0…

点击化学接头BCN-endo-PEG15-NH2,endo-BCN-十五聚乙二醇-胺

&#xff08;本品应密封避光&#xff0c;储存于阴凉&#xff0c;干燥&#xff0c;通风处&#xff0c;取用一定要干燥&#xff0c;避免频繁的溶解和冻干&#xff09; 【产品理化指标】&#xff1a; CAS&#xff1a;N/A 化学式&#xff1a;C43H80N2O17&#xff0c;分子量&#xf…

Vue3+TS+Vite 搭建组件库记录

使用pnpm 安装 npm install pnpm -g初始化package.json pnpm init新建配置文件 .npmrc shamefully-hoist true这里简单说下为什么要配置shamefully-hoist。 如果某些工具仅在根目录的node_modules时才有效&#xff0c;可以将其设置为true来提升那些不在根目录的node_modu…

防火墙安全策略

目录 一、包过滤技术 包过滤 安全策略 安全策略的原理 安全策略分类 二、防火墙的转发原理&#xff08;重点&#xff09; 首包流程 会话表 状态检测机制 会话在转发流程中的位置 多通道协议技术 ASPF 端口识别对多通道协议的支持 分片缓存 三、防火墙的安全策略配…

万应案例精选|跨壁垒、辅决策,万应低代码助力国网电力内部培训数字化架构升级

万应案例精选&#xff5c;跨壁垒、辅决策&#xff0c;万应低代码助力国网电力内部培训数字化架构升级一、项目背景 国网某省电力有限公司&#xff08;下称“国网电力”&#xff09;&#xff0c;是国家电网有限公司的全资子公司&#xff0c;现设20个职能部门&#xff0c;下设16…

智慧法院解决方案-最新全套文件

智慧法院解决方案-最新全套文件一、建设背景二、架构思路三、建设方案四、获取 - 智慧法院全套最新解决方案合集一、建设背景 智慧法院是指充分运用互联网、云计算、大数据、人工智能等技术&#xff0c;促进审判体系与审判能力现代化&#xff0c;实现人民法院 高度智能化的运行…

Java基础—普通阻塞队列

普通阻塞队列 除了刚介绍的两个队列&#xff0c;其他队列都是阻塞队列&#xff0c;都实现了接口BlockingQueue&#xff0c;在入队/出队时可能等待&#xff0c;主要方法有&#xff1a; 入队&#xff0c;如果队列满&#xff0c;等待直到队列有空间 void put(E e) throws Inter…

计算机毕业设计Python+Django的银行取号排队系统

项目介绍 随着信息技术和网络技术的飞速发展&#xff0c;人类已进入全新信息化时代&#xff0c;传统管理技术已无法高效&#xff0c;便捷地管理信息。为了迎合时代需求&#xff0c;优化管理效率&#xff0c;各种各样的管理系统应运而生&#xff0c;各行各业相继进入信息管理时…

MySQL之短时间提高性能的措施

文章目录前言短连接风暴慢查询QPS&#xff08;每秒查询数&#xff09;突增总结前言 我们在使用数据库的时候&#xff0c;总会有那么一段时间&#xff0c;数据库的压力会特别大。比如&#xff0c;用户的使用的高峰期&#xff0c;或者活动上线的时候等等。那么为了应对突然暴增的…

Child Tuning: 反向传播版的Dropout

这篇文章主要是对EMNLP2021上的论文Raise a Child in Large Language Model: Towards Effective and Generalizable Fine-tuning进行讲解。论文标题有些抽象&#xff0c;但是用作者的话来说&#xff0c;这篇论文的思想可以归结为两个词&#xff1a;Child Tuning 虽然这篇文章主…

0-1背包问题

在将什么是0-1背包问题前&#xff0c;先来看下面一道例题&#xff1a; 题意概要&#xff1a;有 n 个物品和一个容量为 W 的背包&#xff0c;每个物品有重量w i和价值v i两种属性&#xff0c;要求 选若干物品放入背包使背包中物品的总价值最大且背包中物品的总重量不超过背包的容…

京东一小伙一年输出20篇专利,其实你也可以

前言&#xff1a; ☆ 本文属于技术总结类干货分享&#xff0c;是实战但又不同于实战&#xff0c;所以不能保证每位同学读后都可以立马自己也输出一篇合格的专利&#xff1b; ☆ 但通过本文的总结分享&#xff0c;已经帮身边同学半年内输出大于100篇专利&#xff0c;所以如果你细…

【字母识别】基于matlab BP神经网络英文字母识别【含Matlab源码 2226期】

⛄一、BP神经网络英文字母识别 1 典型前向网络——BP神经网络 前向网络是目前研究最多的网络形式之一, 它包含输入层、隐层以及输出层, 其中隐层可以为一层或者多层 , 其结构如图1所示. 图1 BP神经网络模型 BP神经网络误差反向传播学习算法的基本思想如下:向网络提供训练例子…