Skip to content

Commit 2afe98a

Browse files
Ticket #17 : Display the workflow definition
1 parent 0d6ba8e commit 2afe98a

146 files changed

Lines changed: 1600 additions & 1499 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ Global
8989
{2D288182-CD6B-46AF-B420-F2038875F6BC} = {A632EFC3-730B-46D7-B669-91962DFA8947}
9090
{1A146C2E-708E-4B50-AE46-37B415CEAFC1} = {D16A3E6D-32B6-44CF-9941-A9BDB9DFC6A7}
9191
{E4C5F767-299D-4D26-916B-59EC7C93CE90} = {CD2E7CFE-4E9C-4308-A0D3-41CD5AD90FD8}
92-
{77FF9E1D-A705-4E04-84CA-FF42D3563F77} = {73DCE7A3-F336-4E72-B36C-9D88860BC897}
92+
{77FF9E1D-A705-4E04-84CA-FF42D3563F77} = {A632EFC3-730B-46D7-B669-91962DFA8947}
9393
{F005FA4D-312C-428C-93A7-4F02C01136A8} = {A632EFC3-730B-46D7-B669-91962DFA8947}
94-
{3DFF3970-7721-4087-8E41-F478D39C2095} = {A632EFC3-730B-46D7-B669-91962DFA8947}
94+
{3DFF3970-7721-4087-8E41-F478D39C2095} = {73DCE7A3-F336-4E72-B36C-9D88860BC897}
9595
{2B86EDF0-DA2D-4FFE-9877-4CBA2999B0A5} = {CD2E7CFE-4E9C-4308-A0D3-41CD5AD90FD8}
9696
{162D547F-D8E8-4B2F-A86C-3F74BF7F4F45} = {A632EFC3-730B-46D7-B669-91962DFA8947}
9797
EndGlobalSection

output.txt

Lines changed: 485 additions & 2 deletions
Large diffs are not rendered by default.

src/CaseManagement.CMMN/Apis/CaseDefinitionsController.cs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ namespace CaseManagement.CMMN.Apis
1515
public class CaseDefinitionsController : Controller
1616
{
1717
private readonly ICMMNWorkflowDefinitionQueryRepository _queryRepository;
18+
private readonly IStatisticQueryRepository _staticQueryRepository;
1819

19-
public CaseDefinitionsController(ICMMNWorkflowDefinitionQueryRepository queryRepository)
20+
public CaseDefinitionsController(ICMMNWorkflowDefinitionQueryRepository queryRepository, IStatisticQueryRepository statisticQueryRepository)
2021
{
2122
_queryRepository = queryRepository;
23+
_staticQueryRepository = statisticQueryRepository;
2224
}
23-
25+
2426
[HttpGet("{id}")]
2527
public async Task<IActionResult> Get(string id)
2628
{
@@ -33,6 +35,22 @@ public async Task<IActionResult> Get(string id)
3335
return new OkObjectResult(ToDto(result));
3436
}
3537

38+
[HttpGet("{id}/history")]
39+
public async Task<IActionResult> GetHistory(string id)
40+
{
41+
var result = await _staticQueryRepository.FindById(id);
42+
if (result == null)
43+
{
44+
result = new CMMNWorkflowDefinitionStatisticAggregate
45+
{
46+
WorkflowDefinitionId = id,
47+
NbInstances = 0
48+
};
49+
}
50+
51+
return new OkObjectResult(ToDto(result));
52+
}
53+
3654
[HttpGet(".search")]
3755
public async Task<IActionResult> Search()
3856
{
@@ -71,6 +89,22 @@ private static JObject ToDto(CMMNWorkflowDefinition def)
7189
};
7290
}
7391

92+
private static JObject ToDto(CMMNWorkflowDefinitionStatisticAggregate def)
93+
{
94+
return new JObject
95+
{
96+
{ "id", def.WorkflowDefinitionId },
97+
{ "nb_instances", def.NbInstances },
98+
{ "elements", new JArray(def.Statistics.Select(s =>
99+
new JObject
100+
{
101+
{ "nb_instances", s.NbInstances },
102+
{ "element", s.ElementDefinitionId }
103+
}
104+
))}
105+
};
106+
}
107+
74108
private static FindWorkflowDefinitionsParameter ExtractFindParameter(IQueryCollection query)
75109
{
76110
int startIndex;

src/CaseManagement.CMMN/Apis/CaseInstancesController.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ public async Task<IActionResult> Search()
5555
return new OkObjectResult(ToDto(result));
5656
}
5757

58+
[HttpGet("{id}")]
59+
public async Task<IActionResult> Get(string id)
60+
{
61+
var result = await _cmmnWorkflowInstanceQueryRepository.FindFlowInstanceById(id);
62+
if (result == null)
63+
{
64+
return new NotFoundResult();
65+
}
66+
67+
return new OkObjectResult(ToDto(result));
68+
}
69+
5870
[HttpPost]
5971
public async Task<IActionResult> Create([FromBody] CreateCaseInstanceCommand createCaseInstance)
6072
{
@@ -93,18 +105,6 @@ public async Task<IActionResult> Launch(string id)
93105
}
94106
}
95107

96-
[HttpGet("{id}")]
97-
public async Task<IActionResult> Get(string id)
98-
{
99-
var flowInstance = await _cmmnWorkflowInstanceQueryRepository.FindFlowInstanceById(id);
100-
if (flowInstance == null)
101-
{
102-
return new NotFoundResult();
103-
}
104-
105-
return new OkObjectResult(ToDto(flowInstance));
106-
}
107-
108108
[HttpGet("{id}/suspend")]
109109
public async Task<IActionResult> Suspend(string id)
110110
{

src/CaseManagement.CMMN/Builders/CMMNWorkflowBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public CMMNWorkflowBuilder AddExitCriteria(string name, Action<CMMNSEntryBuilder
9999

100100
public CMMNWorkflowDefinition Build()
101101
{
102-
var result = CMMNWorkflowDefinition.New(_processFlowTemplateId, _processFlowTemplateId, "", _elements);
102+
var result = CMMNWorkflowDefinition.New(_processFlowTemplateId, _processFlowName, _processFlowName, _elements);
103103
result.ExitCriterias = _exitCriterias;
104104
return result;
105105
}

src/CaseManagement.CMMN/CaseInstance/EventHandlers/CMMNWorkflowElementCreatedEventHandler.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/CaseManagement.CMMN/CaseInstance/EventHandlers/CMMNWorkflowElementFinishedEventHandler.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/CaseManagement.CMMN/CaseInstance/EventHandlers/CMMNWorkflowElementInstanceFormCreatedEventHandler.cs

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/CaseManagement.CMMN/CaseInstance/EventHandlers/CMMNWorkflowElementInstanceFormSubmittedEventHandler.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/CaseManagement.CMMN/CaseInstance/EventHandlers/CMMNWorkflowElementStartedEventHandler.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)