Skip to content

Commit 081be61

Browse files
Thierry Habarthabarthierry-hue
authored andcommitted
Ticket #9 : Try to support timer expression
1 parent 9ce4be1 commit 081be61

125 files changed

Lines changed: 1999 additions & 1131 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CaseManagement.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.CMMN.Host",
2727
EndProject
2828
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.Workflow.Tests", "tests\CaseManagement.Workflow.Tests\CaseManagement.Workflow.Tests.csproj", "{77FF9E1D-A705-4E04-84CA-FF42D3563F77}"
2929
EndProject
30+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.CMMN.Tests", "tests\CaseManagement.CMMN.Tests\CaseManagement.CMMN.Tests.csproj", "{F005FA4D-312C-428C-93A7-4F02C01136A8}"
31+
EndProject
3032
Global
3133
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3234
Debug|Any CPU = Debug|Any CPU
@@ -61,6 +63,10 @@ Global
6163
{77FF9E1D-A705-4E04-84CA-FF42D3563F77}.Debug|Any CPU.Build.0 = Debug|Any CPU
6264
{77FF9E1D-A705-4E04-84CA-FF42D3563F77}.Release|Any CPU.ActiveCfg = Release|Any CPU
6365
{77FF9E1D-A705-4E04-84CA-FF42D3563F77}.Release|Any CPU.Build.0 = Release|Any CPU
66+
{F005FA4D-312C-428C-93A7-4F02C01136A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
67+
{F005FA4D-312C-428C-93A7-4F02C01136A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
68+
{F005FA4D-312C-428C-93A7-4F02C01136A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
69+
{F005FA4D-312C-428C-93A7-4F02C01136A8}.Release|Any CPU.Build.0 = Release|Any CPU
6470
EndGlobalSection
6571
GlobalSection(SolutionProperties) = preSolution
6672
HideSolutionNode = FALSE
@@ -73,6 +79,7 @@ Global
7379
{1A146C2E-708E-4B50-AE46-37B415CEAFC1} = {D16A3E6D-32B6-44CF-9941-A9BDB9DFC6A7}
7480
{E4C5F767-299D-4D26-916B-59EC7C93CE90} = {CD2E7CFE-4E9C-4308-A0D3-41CD5AD90FD8}
7581
{77FF9E1D-A705-4E04-84CA-FF42D3563F77} = {A632EFC3-730B-46D7-B669-91962DFA8947}
82+
{F005FA4D-312C-428C-93A7-4F02C01136A8} = {A632EFC3-730B-46D7-B669-91962DFA8947}
7683
EndGlobalSection
7784
GlobalSection(ExtensibilityGlobals) = postSolution
7885
SolutionGuid = {D2CFBF2E-D493-42F7-B339-01A3070C2B5E}

Doc.docx

129 Bytes
Binary file not shown.

src/CaseManagement.BPMN/ProcessInstance/Processors/BPMNEndEventProcessor.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using CaseManagement.Workflow.Domains;
33
using CaseManagement.Workflow.Engine;
44
using System;
5+
using System.Threading;
56
using System.Threading.Tasks;
67

78
namespace CaseManagement.BPMN.ProcessInstance.Processors
@@ -10,9 +11,10 @@ public class BPMNEndEventProcessor : IProcessFlowElementProcessor
1011
{
1112
public Type ProcessFlowElementType => typeof(BPMNEndEvent);
1213

13-
public Task Handle(ProcessFlowInstance pf, ProcessFlowInstanceElement pfe)
14+
public Task Handle(WorkflowHandlerContext context, CancellationToken token)
1415
{
15-
pf.CompleteElement(pfe);
16+
context.Start();
17+
context.Complete(token);
1618
return Task.FromResult(0);
1719
}
1820
}

src/CaseManagement.BPMN/ProcessInstance/Processors/BPMNReceiveTaskProcessor.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using CaseManagement.BPMN.Domains;
2-
using CaseManagement.Workflow.Domains;
32
using CaseManagement.Workflow.Engine;
43
using System;
4+
using System.Threading;
55
using System.Threading.Tasks;
66

77
namespace CaseManagement.BPMN.ProcessInstance.Processors
@@ -10,11 +10,10 @@ public class BPMNReceiveTaskProcessor : IProcessFlowElementProcessor
1010
{
1111
public Type ProcessFlowElementType { get => typeof(BPMNReceiveTask); }
1212

13-
public Task Handle(ProcessFlowInstance pf, ProcessFlowInstanceElement pfe)
13+
public Task Handle(WorkflowHandlerContext context, CancellationToken token)
1414
{
15-
var receiveTask = pfe as BPMNReceiveTask;
16-
pf.StartElement(pfe);
17-
pf.CompleteElement(pfe);
15+
context.Start();
16+
context.Complete(token);
1817
return Task.FromResult(0);
1918
}
2019
}
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using CaseManagement.BPMN.Domains;
2-
using CaseManagement.Workflow.Domains;
32
using CaseManagement.Workflow.Engine;
43
using System;
4+
using System.Threading;
55
using System.Threading.Tasks;
66

77
namespace CaseManagement.BPMN.ProcessInstance.Processors
@@ -10,14 +10,11 @@ public class BPMNServiceTaskProcessor : IProcessFlowElementProcessor
1010
{
1111
public Type ProcessFlowElementType => typeof(BPMNServiceTask);
1212

13-
public async Task Handle(ProcessFlowInstance pf, ProcessFlowInstanceElement pfe)
13+
public Task Handle(WorkflowHandlerContext context, CancellationToken token)
1414
{
15-
pf.StartElement(pfe);
16-
var serviceTask = (BPMNServiceTask)pfe;
17-
var type = Type.GetType(serviceTask.FullQualifiedName);
18-
// var instance = Activator.CreateInstance(type) as WorkflowTaskDelegate;
19-
// await instance.Handle(pf);
20-
pf.CompleteElement(pfe);
15+
context.Start();
16+
context.Complete(token);
17+
return Task.FromResult(0);
2118
}
2219
}
2320
}

src/CaseManagement.BPMN/ProcessInstance/Processors/BPMNStartEventProcessor.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using CaseManagement.BPMN.Domains;
2-
using CaseManagement.Workflow.Domains;
32
using CaseManagement.Workflow.Engine;
43
using System;
4+
using System.Threading;
55
using System.Threading.Tasks;
66

77
namespace CaseManagement.BPMN.ProcessInstance.Processors
@@ -10,9 +10,10 @@ public class BPMNStartEventProcessor : IProcessFlowElementProcessor
1010
{
1111
public Type ProcessFlowElementType => typeof(BPMNStartEvent);
1212

13-
public Task Handle(ProcessFlowInstance pf, ProcessFlowInstanceElement pfe)
13+
public Task Handle(WorkflowHandlerContext context, CancellationToken token)
1414
{
15-
pf.CompleteElement(pfe);
15+
context.Start();
16+
context.Complete(token);
1617
return Task.FromResult(0);
1718
}
1819
}

src/CaseManagement.BPMN/ProcessInstance/Processors/BPMNTaskProcessor.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
using System;
2-
using System.Threading.Tasks;
3-
using CaseManagement.BPMN.Domains;
4-
using CaseManagement.Workflow.Domains;
1+
using CaseManagement.BPMN.Domains;
52
using CaseManagement.Workflow.Engine;
3+
using System;
4+
using System.Threading;
5+
using System.Threading.Tasks;
66

77
namespace CaseManagement.BPMN.ProcessInstance.Processors
88
{
99
public class BPMNTaskProcessor : IProcessFlowElementProcessor
1010
{
1111
public Type ProcessFlowElementType => typeof(BPMNTask);
1212

13-
public Task Handle(ProcessFlowInstance pf, ProcessFlowInstanceElement pfe)
13+
public Task Handle(WorkflowHandlerContext context, CancellationToken token)
1414
{
15-
pf.CompleteElement(pfe);
15+
context.Start();
16+
context.Complete(token);
1617
return Task.FromResult(0);
1718
}
1819
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
using CaseManagement.CMMN.CaseProcess.ProcessHandlers;
22
using CaseManagement.CMMN.Infrastructures;
3+
using System;
4+
using System.Threading;
35
using System.Threading.Tasks;
46

57
namespace CaseManagement.CMMN.Host.Delegates
68
{
79
public class SendEmailTaskDelegate : CaseProcessDelegate
810
{
9-
public override Task<CaseProcessResponse> Handle(CaseProcessParameter parameter)
11+
public override Task Handle(CaseProcessParameter parameter, Func<CaseProcessResponse, Task> callback, CancellationToken token)
1012
{
11-
return Task.FromResult(new CaseProcessResponse());
13+
return callback(new CaseProcessResponse());
1214
}
1315
}
1416
}
Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using CaseManagement.CMMN.CaseInstance.EventHandlers;
2-
using CaseManagement.Workflow.Domains.Events;
3-
using CaseManagement.Workflow.Infrastructure.EvtBus;
4-
using Hangfire;
1+
using Hangfire;
52

63
namespace Microsoft.AspNetCore.Builder
74
{
@@ -10,18 +7,8 @@ public static class ApplicationBuilderExtensions
107
public static IApplicationBuilder UseCMMN(this IApplicationBuilder appBuilder)
118
{
129
appBuilder.UseHangfireServer();
13-
appBuilder.ConfigureEventBus();
1410
appBuilder.UseMvc();
1511
return appBuilder;
1612
}
17-
18-
private static void ConfigureEventBus(this IApplicationBuilder app)
19-
{
20-
var evtBus = (IEventBus)app.ApplicationServices.GetService(typeof(IEventBus));
21-
evtBus.Subscribe<ProcessFlowInstanceCreatedEvent, ProcessFlowInstanceCreatedEventHandler>();
22-
evtBus.Subscribe<ProcessFlowInstanceLaunchedEvent, ProcessFlowInstanceLaunchedEventHandler>();
23-
evtBus.Subscribe<ProcessFlowInstanceFormConfirmedEvent, ProcessFlowInstanceFormConfirmedEventHandler>();
24-
evtBus.Subscribe<ProcessFlowElementLaunchedEvent, ProcessFlowElementLaunchedEventHandler>();
25-
}
2613
}
2714
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using CaseManagement.CMMN.Domains;
2+
3+
namespace CaseManagement.CMMN.Builders
4+
{
5+
public class CMMNHumanTaskBuilder : CMMNTaskBuilder
6+
{
7+
public CMMNHumanTaskBuilder(CMMNPlanItem planItem) : base(planItem)
8+
{
9+
}
10+
11+
public CMMNHumanTaskBuilder SetFormId(string formId)
12+
{
13+
var cmmnTask = (CMMNHumanTask)PlanItem.PlanItemDefinition;
14+
cmmnTask.FormId = formId;
15+
return this;
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)