add -- 添加流程模型和部署管理模块
This commit is contained in:
@@ -8,6 +8,8 @@ package com.ruoyi.flowable.common.constant;
|
||||
*/
|
||||
public class ProcessConstants {
|
||||
|
||||
public static final String SUFFIX = ".bpmn";
|
||||
|
||||
/**
|
||||
* 动态数据
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.ruoyi.flowable.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author KonBAI
|
||||
* @createTime 2022/6/28 9:51
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FormType {
|
||||
|
||||
/**
|
||||
* 流程表单
|
||||
*/
|
||||
PROCESS(0),
|
||||
|
||||
/**
|
||||
* 外置表单
|
||||
*/
|
||||
EXTERNAL(1),
|
||||
|
||||
/**
|
||||
* 节点独立表单
|
||||
*/
|
||||
INDEPENDENT(2);
|
||||
|
||||
/**
|
||||
* 表单类型
|
||||
*/
|
||||
private final Integer type;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.flowable.utils;
|
||||
|
||||
import org.flowable.bpmn.converter.BpmnXMLConverter;
|
||||
import org.flowable.bpmn.model.BpmnModel;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.bpmn.model.Process;
|
||||
import org.flowable.bpmn.model.StartEvent;
|
||||
import org.flowable.common.engine.impl.util.io.StringStreamSource;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author KonBAI
|
||||
* @createTime 2022/3/26 19:04
|
||||
*/
|
||||
public class ModelUtils {
|
||||
|
||||
private static final BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
|
||||
|
||||
/**
|
||||
* xml转bpmnModel对象
|
||||
*
|
||||
* @param xml xml
|
||||
* @return bpmnModel对象
|
||||
*/
|
||||
public static BpmnModel getBpmnModel(String xml) {
|
||||
return bpmnXMLConverter.convertToBpmnModel(new StringStreamSource(xml), false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开始节点
|
||||
*
|
||||
* @param model bpmnModel对象
|
||||
* @return 开始节点(未找到开始节点,返回null)
|
||||
*/
|
||||
public static StartEvent getStartEvent(BpmnModel model) {
|
||||
Process process = model.getMainProcess();
|
||||
Collection<FlowElement> elements = process.getFlowElements();
|
||||
return (StartEvent) elements.stream()
|
||||
.filter(flowElement -> flowElement instanceof StartEvent)
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user