优化代码
This commit is contained in:
@@ -81,11 +81,16 @@ public abstract class FlowableManager {
|
||||
}
|
||||
|
||||
public String start(String nodeId, Map<String, Object> metadata) {
|
||||
return start(nodeId, metadata, null);
|
||||
}
|
||||
|
||||
public String start(String nodeId, Map<String, Object> 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));
|
||||
|
||||
@@ -22,6 +22,9 @@ public class FlowableMetadata implements Serializable {
|
||||
}
|
||||
|
||||
public FlowableMetadata(Map<String, Object> metadata) {
|
||||
if (metadata == null) {
|
||||
metadata = new HashMap<>();
|
||||
}
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user