From 3bf475708a46fcc57eed99f1d29c022043f1be28 Mon Sep 17 00:00:00 2001 From: canonical Date: Tue, 28 Nov 2023 22:30:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=A5=E4=BD=9C=E6=B5=81?= =?UTF-8?q?=E7=9A=84=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wf/core/model/_gen/_WfJoinStepModel.java | 2 +- .../io/nop/wf/core/model/_gen/_WfModel.java | 30 +++++++++++++++++-- .../nop/wf/core/model/_gen/_WfModelAuth.java | 27 +++++++++++++++++ .../nop/wf/core/model/_gen/_WfStepModel.java | 27 +++++++++++++++++ .../core/model/_gen/_WfSubFlowArgModel.java | 2 +- .../wf/core/model/_gen/_WfSubFlowModel.java | 2 +- .../model/_gen/_WfSubFlowReturnModel.java | 2 +- .../core/model/_gen/_WfSubFlowStartModel.java | 2 +- .../io/nop/wf/service/TestWorkflowEngine.java | 4 +-- 9 files changed, 89 insertions(+), 9 deletions(-) diff --git a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfJoinStepModel.java b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfJoinStepModel.java index d4e554883..3099aec5d 100644 --- a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfJoinStepModel.java +++ b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfJoinStepModel.java @@ -7,7 +7,7 @@ // tell cpd to start ignoring code - CPD-OFF /** - * generate from [234:10:0:0]/nop/schema/wf/wf.xdef

+ * generate from [236:10:0:0]/nop/schema/wf/wf.xdef

* */ @SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable", diff --git a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfModel.java b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfModel.java index c29ee2e93..c333a995e 100644 --- a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfModel.java +++ b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfModel.java @@ -34,7 +34,7 @@ public abstract class _WfModel extends io.nop.core.resource.component.AbstractCo * xml name: auths * */ - private java.util.List _auths = java.util.Collections.emptyList(); + private KeyedList _auths = KeyedList.emptyList(); /** * @@ -269,11 +269,37 @@ public java.util.List getAuths(){ public void setAuths(java.util.List value){ checkAllowChange(); - this._auths = value; + this._auths = KeyedList.fromList(value, io.nop.wf.core.model.WfModelAuth::getId); } + public io.nop.wf.core.model.WfModelAuth getAuth(String name){ + return this._auths.getByKey(name); + } + + public boolean hasAuth(String name){ + return this._auths.containsKey(name); + } + + public void addAuth(io.nop.wf.core.model.WfModelAuth item) { + checkAllowChange(); + java.util.List list = this.getAuths(); + if (list == null || list.isEmpty()) { + list = new KeyedList<>(io.nop.wf.core.model.WfModelAuth::getId); + setAuths(list); + } + list.add(item); + } + + public java.util.Set keySet_auths(){ + return this._auths.keySet(); + } + + public boolean hasAuths(){ + return !this._auths.isEmpty(); + } + /** * * xml name: bizEntityStateProp diff --git a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfModelAuth.java b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfModelAuth.java index dd7a70180..f005174dc 100644 --- a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfModelAuth.java +++ b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfModelAuth.java @@ -56,6 +56,13 @@ public abstract class _WfModelAuth extends io.nop.core.resource.component.Abstra */ private java.lang.String _deptId ; + /** + * + * xml name: id + * + */ + private java.lang.String _id ; + /** * * xml name: actorId @@ -170,6 +177,25 @@ public void setDeptId(java.lang.String value){ } + /** + * + * xml name: id + * + */ + + public java.lang.String getId(){ + return _id; + } + + + public void setId(java.lang.String value){ + checkAllowChange(); + + this._id = value; + + } + + public void freeze(boolean cascade){ if(frozen()) return; @@ -189,6 +215,7 @@ protected void outputJson(IJsonHandler out){ out.put("allowManage",this.isAllowManage()); out.put("allowStart",this.isAllowStart()); out.put("deptId",this.getDeptId()); + out.put("id",this.getId()); } } // resume CPD analysis - CPD-ON diff --git a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfStepModel.java b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfStepModel.java index 61110a0f3..737517e1e 100644 --- a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfStepModel.java +++ b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfStepModel.java @@ -49,6 +49,13 @@ public abstract class _WfStepModel extends io.nop.core.resource.component.Abstra */ private io.nop.wf.core.model.WfAssignmentModel _assignment ; + /** + * + * xml name: before-transition + * + */ + private io.nop.core.lang.eval.IEvalAction _beforeTransition ; + /** * * xml name: bizEntityState @@ -298,6 +305,25 @@ public void setAssignment(io.nop.wf.core.model.WfAssignmentModel value){ } + /** + * + * xml name: before-transition + * + */ + + public io.nop.core.lang.eval.IEvalAction getBeforeTransition(){ + return _beforeTransition; + } + + + public void setBeforeTransition(io.nop.core.lang.eval.IEvalAction value){ + checkAllowChange(); + + this._beforeTransition = value; + + } + + /** * * xml name: bizEntityState @@ -766,6 +792,7 @@ protected void outputJson(IJsonHandler out){ out.put("allowWithdraw",this.isAllowWithdraw()); out.put("appState",this.getAppState()); out.put("assignment",this.getAssignment()); + out.put("beforeTransition",this.getBeforeTransition()); out.put("bizEntityState",this.getBizEntityState()); out.put("checkComplete",this.getCheckComplete()); out.put("displayName",this.getDisplayName()); diff --git a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowArgModel.java b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowArgModel.java index cc20d7991..3f0fe1c9b 100644 --- a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowArgModel.java +++ b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowArgModel.java @@ -7,7 +7,7 @@ // tell cpd to start ignoring code - CPD-OFF /** - * generate from [252:18:0:0]/nop/schema/wf/wf.xdef

+ * generate from [254:18:0:0]/nop/schema/wf/wf.xdef

* */ @SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable", diff --git a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowModel.java b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowModel.java index 3ef9c5e7f..ec2141bf9 100644 --- a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowModel.java +++ b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowModel.java @@ -7,7 +7,7 @@ // tell cpd to start ignoring code - CPD-OFF /** - * generate from [249:10:0:0]/nop/schema/wf/wf.xdef

+ * generate from [251:10:0:0]/nop/schema/wf/wf.xdef

* 子流程 */ @SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable", diff --git a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowReturnModel.java b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowReturnModel.java index 1fc52a9e7..dfbf2a25c 100644 --- a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowReturnModel.java +++ b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowReturnModel.java @@ -7,7 +7,7 @@ // tell cpd to start ignoring code - CPD-OFF /** - * generate from [259:18:0:0]/nop/schema/wf/wf.xdef

+ * generate from [261:18:0:0]/nop/schema/wf/wf.xdef

* 将子工作流中的output变量返回到本工作流中作为变量var */ @SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable", diff --git a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowStartModel.java b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowStartModel.java index b1f88c1ad..84c101177 100644 --- a/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowStartModel.java +++ b/nop-wf/nop-wf-core/src/main/java/io/nop/wf/core/model/_gen/_WfSubFlowStartModel.java @@ -7,7 +7,7 @@ // tell cpd to start ignoring code - CPD-OFF /** - * generate from [250:14:0:0]/nop/schema/wf/wf.xdef

+ * generate from [252:14:0:0]/nop/schema/wf/wf.xdef

* */ @SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable", diff --git a/nop-wf/nop-wf-service/src/test/java/io/nop/wf/service/TestWorkflowEngine.java b/nop-wf/nop-wf-service/src/test/java/io/nop/wf/service/TestWorkflowEngine.java index fe8fb69e0..a4e53ff99 100644 --- a/nop-wf/nop-wf-service/src/test/java/io/nop/wf/service/TestWorkflowEngine.java +++ b/nop-wf/nop-wf-service/src/test/java/io/nop/wf/service/TestWorkflowEngine.java @@ -7,6 +7,7 @@ */ package io.nop.wf.service; +import io.nop.api.core.context.ContextProvider; import io.nop.auth.dao.entity.NopAuthUser; import io.nop.core.context.IServiceContext; import io.nop.core.context.ServiceContextImpl; @@ -58,13 +59,12 @@ void setUp() { WorkflowEngineImpl engine = new WorkflowEngineImpl(); engine.setWfActorResolver(new MockWfActorResolver()); - //engine.setWorkflowCoordinator(); workflowManager.setWorkflowEngine(engine); MockWorkflowStore store = new MockWorkflowStore(); workflowManager.setWorkflowStore(store); - // workflowManager.setWorkflowModelStore(new ResourceWorkflowModelStore()); workflowManager.init(); + ContextProvider.getOrCreateContext().setUserId("1"); } /**