From 77567d997dc0f2ac4f1acbaa69905c385de12336 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Tue, 7 Jan 2025 17:14:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flowable/jpa/SpringFlowableAutoConfiguration.java | 3 +-- .../flowable/core/manager/FlowableManager.java | 5 +++++ .../lanyuanxiaoyao/flowable/core/model/FlowableMetadata.java | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableAutoConfiguration.java b/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableAutoConfiguration.java index d43c812..df0a4e7 100644 --- a/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableAutoConfiguration.java +++ b/adapter/flowable-spring-boot-jpa-starter/src/main/java/com/lanyuanxiaoyao/flowable/jpa/SpringFlowableAutoConfiguration.java @@ -11,7 +11,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @@ -21,8 +20,8 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories; * @author lanyuanxiaoyao * @version 20250103 */ +@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") @Configuration -@ComponentScan @EnableJpaRepositories("com.lanyuanxiaoyao.flowable.jpa.repository") @EnableConfigurationProperties(SpringFlowableConfiguration.class) public class SpringFlowableAutoConfiguration { diff --git a/flowable-core/src/main/java/com/lanyuanxiaoyao/flowable/core/manager/FlowableManager.java b/flowable-core/src/main/java/com/lanyuanxiaoyao/flowable/core/manager/FlowableManager.java index 47c10b8..8f20509 100644 --- a/flowable-core/src/main/java/com/lanyuanxiaoyao/flowable/core/manager/FlowableManager.java +++ b/flowable-core/src/main/java/com/lanyuanxiaoyao/flowable/core/manager/FlowableManager.java @@ -81,11 +81,16 @@ public abstract class FlowableManager { } public String start(String nodeId, Map metadata) { + return start(nodeId, metadata, null); + } + + public String start(String nodeId, Map metadata, String extra) { FlowableNode node = repository.getNode(nodeId); FlowableInstance instance = FlowableInstance.builder() .instanceId(createId()) .currentNodeId(node.getNodeId()) .metadata(new FlowableMetadata(metadata)) + .extra(extra) .build(); repository.saveInstance(instance); callListeners(node.getListeners(), listener -> listener.onFlowStart(instance, node)); diff --git a/flowable-core/src/main/java/com/lanyuanxiaoyao/flowable/core/model/FlowableMetadata.java b/flowable-core/src/main/java/com/lanyuanxiaoyao/flowable/core/model/FlowableMetadata.java index 11eb6db..77267ad 100644 --- a/flowable-core/src/main/java/com/lanyuanxiaoyao/flowable/core/model/FlowableMetadata.java +++ b/flowable-core/src/main/java/com/lanyuanxiaoyao/flowable/core/model/FlowableMetadata.java @@ -22,6 +22,9 @@ public class FlowableMetadata implements Serializable { } public FlowableMetadata(Map metadata) { + if (metadata == null) { + metadata = new HashMap<>(); + } this.metadata = metadata; }