| | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.json.utils.JsonUtils; |
| | |
| | | * |
| | | * @author may |
| | | */ |
| | | @NoArgsConstructor(access = AccessLevel.PRIVATE) |
| | | public class ModelUtils { |
| | | public ModelUtils() { |
| | | } |
| | | |
| | | public static BpmnModel xmlToBpmnModel(String xml) throws IOException { |
| | | if (xml == null) { |
| | |
| | | * |
| | | * @param processDefinitionId 流程定义id |
| | | */ |
| | | public Map<String, List<ExtensionElement>> getExtensionElements(String processDefinitionId) { |
| | | public static Map<String, List<ExtensionElement>> getExtensionElements(String processDefinitionId) { |
| | | Map<String, List<ExtensionElement>> map = new HashMap<>(); |
| | | List<FlowElement> flowElements = getFlowElements(processDefinitionId); |
| | | for (FlowElement flowElement : flowElements) { |
| | |
| | | * @param processDefinitionId 流程定义id |
| | | * @param flowElementId 节点id |
| | | */ |
| | | public Map<String, List<ExtensionElement>> getExtensionElement(String processDefinitionId, String flowElementId) { |
| | | public static Map<String, List<ExtensionElement>> getExtensionElement(String processDefinitionId, String flowElementId) { |
| | | BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionId); |
| | | Process process = bpmnModel.getMainProcess(); |
| | | FlowElement flowElement = process.getFlowElement(flowElementId); |
| | | return flowElement.getExtensionElements(); |
| | | } |
| | | |
| | | /** |
| | | * 判断当前节点是否为用户任务 |
| | | * |
| | | * @param processDefinitionId 流程定义id |
| | | * @param taskDefinitionKey 流程定义id |
| | | */ |
| | | public static boolean isUserTask(String processDefinitionId, String taskDefinitionKey) { |
| | | BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionId); |
| | | FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(taskDefinitionKey); |
| | | return flowNode instanceof UserTask; |
| | | } |
| | | } |