Class ModelHelper


  • public class ModelHelper
    extends java.lang.Object
    流程模型辅助类

    官网尊重知识产权,不允许非法使用,后果自负

    Since:
    1.0
    Author:
    hubin
    • Constructor Detail

      • ModelHelper

        public ModelHelper()
    • Method Detail

      • buildProcessModel

        public static ProcessModel buildProcessModel​(java.lang.String jsonModel)
        构建流程模型

        确保已经实现JSON解析处理器接口

        Parameters:
        jsonModel - 流程模型JSON格式
        Returns:
        流程模型
      • getNextChildNodes

        public static java.util.List<NodeModel> getNextChildNodes​(FlowLongContext flowLongContext,
                                                                  Execution execution,
                                                                  NodeModel rootNodeModel,
                                                                  java.lang.String currentNodeKey)
        动态获取下一个节点
        Parameters:
        flowLongContext - 流程上下文 FlowLongContext
        execution - 流程执行对象 Execution
        rootNodeModel - 根节点
        currentNodeKey - 当前节点
        Returns:
        下一个节点集合
      • findNextNode

        public static NodeModel findNextNode​(NodeModel nodeModel,
                                             java.util.List<java.lang.String> currentTask)
        递归查找下一个执行节点
        Parameters:
        nodeModel - 当前节点
        currentTask - 当前任务列表
        Returns:
        流程节点模型
      • getAllPreviousNodeKeys

        public static java.util.List<java.lang.String> getAllPreviousNodeKeys​(NodeModel nodeModel)
        获取所有上一个节点key,只包含发起节点和审批节点(非直接所在条件分支排除在外)
        Parameters:
        nodeModel - 当前节点
        Returns:
        所有节点key
      • getAllNextConditionNodeKeys

        public static java.util.List<java.lang.String> getAllNextConditionNodeKeys​(NodeModel nodeModel)
        获取所有下一个节点key,递归所有子节点
        Parameters:
        nodeModel - 当前节点模型
        Returns:
        所有节点key
      • getUnsetAssigneeNodes

        public static java.util.List<NodeModel> getUnsetAssigneeNodes​(NodeModel rootNodeModel)
        获取所有未设置处理人员节点【非发起人自己,只包含 1,审批 2,抄送 节点】
        Parameters:
        rootNodeModel - 根节点模型
        Returns:
        所有节点名称
      • getRootNodeAllChildNodes

        public static java.util.List<NodeModel> getRootNodeAllChildNodes​(NodeModel rootNodeModel)
        获取根节点下的所有节点模型【 注意,只对根节点查找有效!】
        Parameters:
        rootNodeModel - 根节点模型
        Returns:
        所有节点信息
      • checkNodeModel

        public static int checkNodeModel​(NodeModel rootNodeModel)
        检查节点模型,检测节点模型需要构建父节点
        Parameters:
        rootNodeModel - 根节点模型
        Returns:
        0,正常 1,存在重复节点KEY 2,自动通过节点配置错误 3,自动拒绝节点配置错误 4,路由节点必须配置错误(未配置路由分支) 5,子流程节点配置错误(未选择子流程) 6,抄送节点配置错误(未配置处理人,且不允许抄送自选)
      • inConditionNode

        public static boolean inConditionNode​(NodeModel nodeModel)
        判断节点是否在条件节点中
        Parameters:
        nodeModel - NodeModel
        Returns:
        true 是 false 否
      • checkConditionNode

        public static int checkConditionNode​(NodeModel nodeModel)
        检查条件节点
        Parameters:
        nodeModel - NodeModel
        Returns:
        0,合法情况 1,存在多个条件表达式为空 2,存在多个条件子节点为空 3,存在条件节点KEY重复
      • checkExistApprovalNode

        public static boolean checkExistApprovalNode​(NodeModel rootNodeModel)
        检查是否存在审批节点
        Parameters:
        rootNodeModel - 根节点模型
        Returns:
        true 存在 false 不存在
      • generateNodeKey

        public static java.lang.String generateNodeKey()
        生成节点KEY规则(flk + 时间戳)
        Returns:
        节点KEY
      • getNodeModel

        public static NodeModel getNodeModel​(java.lang.String nodeKey,
                                             NodeModel rootNodeModel)
        获取指定节点KEY模型信息
        Parameters:
        nodeKey - 节点 KEY
        rootNodeModel - 根节点模型
        Returns:
        JSON BPM 节点
      • reloadProcessModel

        public static void reloadProcessModel​(FlowLongContext flowLongContext,
                                              java.lang.Long flwInstanceId,
                                              ProcessModel processModel)
        重新加载流程模型
        Parameters:
        flowLongContext - 流程上下文
        flwInstanceId - 流程实例ID
        processModel - 流程模型
      • reloadProcessModel

        public static void reloadProcessModel​(ProcessModel processModel,
                                              java.util.function.Consumer<ProcessModel> consumer)
        重新加载流程模型
        Parameters:
        processModel - 流程模型
        consumer - 流程模型消费
      • getAllUsedNodeKeys

        public static java.util.List<java.lang.String> getAllUsedNodeKeys​(FlowLongContext flowLongContext,
                                                                          Execution execution,
                                                                          NodeModel rootNodeModel,
                                                                          java.lang.String currentNodeKey)
        获取当前已使用的节点key列表
        Parameters:
        flowLongContext - 流程上下文 FlowLongContext
        execution - 流程执行对象 Execution
        rootNodeModel - 模型根节点 NodeModel
        currentNodeKey - 当前所在节点
        Returns:
        当前已使用的节点key列表
      • getChildAllUsedNodeKeys

        public static void getChildAllUsedNodeKeys​(java.util.List<java.lang.String> currentUsedNodeKeys,
                                                   FlowLongContext flowLongContext,
                                                   Execution execution,
                                                   NodeModel rootNodeModel,
                                                   java.lang.String currentNodeKey)
        获取已使用所有的子节点key列表
      • getParentConditionNodeKeys

        public static java.util.List<java.lang.String> getParentConditionNodeKeys​(NodeModel nodeModel)
        获取当前节点父条件节点所有子节点key列表
        Parameters:
        nodeModel - 当前节点
        Returns:
        并行节点所有子节点key列表