Skip to content

Commit 149e384

Browse files
Ticket #5 : Add angular UI
1 parent 630243a commit 149e384

185 files changed

Lines changed: 18960 additions & 40 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: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "01. BPMN", "01. BPMN", "{4E
77
EndProject
88
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.BPMN", "src\CaseManagement.BPMN\CaseManagement.BPMN.csproj", "{D7A0C87C-CF5B-48CF-9A0F-FE7F6248BB30}"
99
EndProject
10-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "03. Tests", "03. Tests", "{A632EFC3-730B-46D7-B669-91962DFA8947}"
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "04. Tests", "04. Tests", "{A632EFC3-730B-46D7-B669-91962DFA8947}"
1111
EndProject
1212
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "02. CMMN", "02. CMMN", "{CD2E7CFE-4E9C-4308-A0D3-41CD5AD90FD8}"
1313
EndProject
@@ -19,6 +19,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.Workflow", "
1919
EndProject
2020
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.CMMN.Acceptance.Tests", "tests\CaseManagement.CMMN.Acceptance.Tests\CaseManagement.CMMN.Acceptance.Tests.csproj", "{2D288182-CD6B-46AF-B420-F2038875F6BC}"
2121
EndProject
22+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "03. Website", "03. Website", "{D16A3E6D-32B6-44CF-9941-A9BDB9DFC6A7}"
23+
EndProject
24+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.Website", "src\CaseManagement.Website\CaseManagement.Website.csproj", "{1A146C2E-708E-4B50-AE46-37B415CEAFC1}"
25+
EndProject
26+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.CMMN.Host", "src\CaseManagement.CMMN.Host\CaseManagement.CMMN.Host.csproj", "{E4C5F767-299D-4D26-916B-59EC7C93CE90}"
27+
EndProject
2228
Global
2329
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2430
Debug|Any CPU = Debug|Any CPU
@@ -41,6 +47,14 @@ Global
4147
{2D288182-CD6B-46AF-B420-F2038875F6BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
4248
{2D288182-CD6B-46AF-B420-F2038875F6BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
4349
{2D288182-CD6B-46AF-B420-F2038875F6BC}.Release|Any CPU.Build.0 = Release|Any CPU
50+
{1A146C2E-708E-4B50-AE46-37B415CEAFC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51+
{1A146C2E-708E-4B50-AE46-37B415CEAFC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
52+
{1A146C2E-708E-4B50-AE46-37B415CEAFC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
53+
{1A146C2E-708E-4B50-AE46-37B415CEAFC1}.Release|Any CPU.Build.0 = Release|Any CPU
54+
{E4C5F767-299D-4D26-916B-59EC7C93CE90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
55+
{E4C5F767-299D-4D26-916B-59EC7C93CE90}.Debug|Any CPU.Build.0 = Debug|Any CPU
56+
{E4C5F767-299D-4D26-916B-59EC7C93CE90}.Release|Any CPU.ActiveCfg = Release|Any CPU
57+
{E4C5F767-299D-4D26-916B-59EC7C93CE90}.Release|Any CPU.Build.0 = Release|Any CPU
4458
EndGlobalSection
4559
GlobalSection(SolutionProperties) = preSolution
4660
HideSolutionNode = FALSE
@@ -50,6 +64,8 @@ Global
5064
{CE4424E0-4EC0-45D0-9791-91864EDEA89B} = {CD2E7CFE-4E9C-4308-A0D3-41CD5AD90FD8}
5165
{E3E72DF1-F427-4FEA-8F84-FB194EA20D07} = {9360C4A1-A2AA-4493-BBDC-4044D78D8F4B}
5266
{2D288182-CD6B-46AF-B420-F2038875F6BC} = {A632EFC3-730B-46D7-B669-91962DFA8947}
67+
{1A146C2E-708E-4B50-AE46-37B415CEAFC1} = {D16A3E6D-32B6-44CF-9941-A9BDB9DFC6A7}
68+
{E4C5F767-299D-4D26-916B-59EC7C93CE90} = {CD2E7CFE-4E9C-4308-A0D3-41CD5AD90FD8}
5369
EndGlobalSection
5470
GlobalSection(ExtensibilityGlobals) = postSolution
5571
SolutionGuid = {D2CFBF2E-D493-42F7-B339-01A3070C2B5E}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
<PropertyGroup>
3+
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<OutputType>Exe</OutputType>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<PackageReference Include="Microsoft.AspNetCore.App" />
8+
</ItemGroup>
9+
<ItemGroup>
10+
<ProjectReference Include="..\CaseManagement.CMMN\CaseManagement.CMMN.csproj" />
11+
</ItemGroup>
12+
<ItemGroup>
13+
<Folder Include="Cmmns\" />
14+
</ItemGroup>
15+
<ItemGroup>
16+
<None Update="Cmmns\firstDiagram.cmmn">
17+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
18+
</None>
19+
</ItemGroup>
20+
</Project>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<cmmn:definitions xmlns:dc="http://www.omg.org/spec/CMMN/20151109/DC" xmlns:case="https://github.com/simpleidserver/CaseManagement" xmlns:di="http://www.omg.org/spec/CMMN/20151109/DI" xmlns:cmmndi="http://www.omg.org/spec/CMMN/20151109/CMMNDI" xmlns:cmmn="http://www.omg.org/spec/CMMN/20151109/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="firstDiagramm" targetNamespace="http://bpmn.io/schema/cmmn" exporter="cmmn-js (https://demo.bpmn.io/cmmn)" exporterVersion="0.19.2">
3+
<cmmn:case id="Case_1ey12wl">
4+
<cmmn:casePlanModel id="CasePlanModel_01toj1d" name="Confirm meeting">
5+
<cmmn:planItem id="PlanItem_1wg0ql8" definitionRef="ProcessTask_03n8qmv">
6+
<cmmn:entryCriterion id="EntryCriterion_03ushby" sentryRef="Sentry_174kp1p" />
7+
</cmmn:planItem>
8+
<cmmn:planItem id="PlanItem_1iqs5hf" definitionRef="HumanTask_07z2osx" />
9+
<cmmn:sentry id="Sentry_174kp1p">
10+
<cmmn:planItemOnPart id="PlanItemOnPart_1ycnj6m" sourceRef="PlanItem_1iqs5hf">
11+
<cmmn:standardEvent>complete</cmmn:standardEvent>
12+
</cmmn:planItemOnPart>
13+
</cmmn:sentry>
14+
<cmmn:processTask id="ProcessTask_03n8qmv" name="Send email" case:assemblyQualifiedName="CaseManagement.CMMN.Acceptance.Tests.Delegates.SendEmailTaskDelegate, CaseManagement.CMMN.Acceptance.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
15+
<cmmn:humanTask id="HumanTask_07z2osx" name="Create meeting" case:formRef="createMeetingForm" />
16+
</cmmn:casePlanModel>
17+
</cmmn:case>
18+
<cmmndi:CMMNDI>
19+
<cmmndi:CMMNDiagram sharedStyle="b243f551-296a-4bc8-8a8a-0d5e343ed60f" id="_5a66685b-5f57-4e2f-b1d1-acca4fae04b2" name="Claims File">
20+
<cmmndi:Size width="1313.31396484375" height="1009" />
21+
<cmmndi:CMMNShape id="CasePlanModel_01toj1d_di" cmmnElementRef="CasePlanModel_01toj1d">
22+
<dc:Bounds x="156" y="141" width="445" height="223" />
23+
<cmmndi:CMMNLabel />
24+
</cmmndi:CMMNShape>
25+
<cmmndi:CMMNShape id="EntryCriterion_03ushby_di" cmmnElementRef="EntryCriterion_03ushby">
26+
<dc:Bounds x="389" y="234" width="20" height="28" />
27+
<cmmndi:CMMNLabel />
28+
</cmmndi:CMMNShape>
29+
<cmmndi:CMMNEdge id="PlanItemOnPart_1ycnj6m_di" cmmnElementRef="PlanItemOnPart_1ycnj6m" targetCMMNElementRef="EntryCriterion_03ushby" isStandardEventVisible="true">
30+
<di:waypoint x="276" y="249" />
31+
<di:waypoint x="333" y="249" />
32+
<di:waypoint x="333" y="248" />
33+
<di:waypoint x="389" y="248" />
34+
<cmmndi:CMMNLabel>
35+
<dc:Bounds x="312" y="228.5" width="51" height="12" />
36+
</cmmndi:CMMNLabel>
37+
</cmmndi:CMMNEdge>
38+
<cmmndi:CMMNShape id="PlanItem_0p5chnw_di" cmmnElementRef="PlanItem_1wg0ql8">
39+
<dc:Bounds x="399" y="209" width="100" height="80" />
40+
<cmmndi:CMMNLabel />
41+
</cmmndi:CMMNShape>
42+
<cmmndi:CMMNShape id="PlanItem_0hwtr7d_di" cmmnElementRef="PlanItem_1iqs5hf">
43+
<dc:Bounds x="176" y="209" width="100" height="80" />
44+
<cmmndi:CMMNLabel />
45+
</cmmndi:CMMNShape>
46+
</cmmndi:CMMNDiagram>
47+
<cmmndi:CMMNStyle id="b243f551-296a-4bc8-8a8a-0d5e343ed60f" fontFamily="Arial,Helvetica,sans-serif" />
48+
</cmmndi:CMMNDI>
49+
</cmmn:definitions>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) SimpleIdServer. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+
using Microsoft.AspNetCore;
4+
using Microsoft.AspNetCore.Hosting;
5+
6+
namespace CaseManagement.CMMN.Host
7+
{
8+
public class Program
9+
{
10+
public static void Main(string[] args)
11+
{
12+
CreateWebHostBuilder(args).Build().Run();
13+
}
14+
15+
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
16+
WebHost.CreateDefaultBuilder(args)
17+
.UseStartup<Startup>();
18+
}
19+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"profiles": {
3+
"CaseManagement.CMMN.Host": {
4+
"commandName": "Project",
5+
"environmentVariables": {
6+
"ASPNETCORE_ENVIRONMENT": "Development"
7+
},
8+
"applicationUrl": "http://localhost:54942/"
9+
}
10+
}
11+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright (c) SimpleIdServer. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+
using CaseManagement.Workflow.Domains;
4+
using Microsoft.AspNetCore.Builder;
5+
using Microsoft.AspNetCore.Hosting;
6+
using Microsoft.Extensions.DependencyInjection;
7+
using Microsoft.Extensions.Logging;
8+
using System.Collections.Generic;
9+
using System.IO;
10+
11+
namespace CaseManagement.CMMN.Host
12+
{
13+
public class Startup
14+
{
15+
public Startup(IHostingEnvironment env) { }
16+
17+
public void ConfigureServices(IServiceCollection services)
18+
{
19+
var builder = services.AddCMMN();
20+
services.AddCors(options => options.AddPolicy("AllowAll", p => p.AllowAnyOrigin()
21+
.AllowAnyMethod()
22+
.AllowAnyHeader()));
23+
builder.AddDefinitions(c =>
24+
{
25+
foreach (var file in Directory.EnumerateFiles(Path.Combine(Directory.GetCurrentDirectory(), "Cmmns"), "*.cmmn"))
26+
{
27+
c.ImportDefinition(file);
28+
}
29+
})
30+
.AddForms(new List<Form>
31+
{
32+
new Form
33+
{
34+
Id = "createMeetingForm",
35+
Elements = new List<FormElement>
36+
{
37+
new FormElement
38+
{
39+
Id = "name",
40+
Type = FormElementTypes.TXT
41+
}
42+
}
43+
}
44+
});
45+
}
46+
47+
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
48+
{
49+
app.UseCors("AllowAll");
50+
app.UseCMMN();
51+
}
52+
}
53+
}

src/CaseManagement.CMMN/Apis/CaseDefinitionsController.cs

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
using CaseManagement.CMMN.Persistence;
1+
using CaseManagement.CMMN.Extensions;
2+
using CaseManagement.CMMN.Parser;
3+
using CaseManagement.CMMN.Persistence;
4+
using CaseManagement.Workflow.Persistence.Parameters;
5+
using CaseManagement.Workflow.Persistence.Responses;
6+
using Microsoft.AspNetCore.Http;
27
using Microsoft.AspNetCore.Mvc;
38
using Newtonsoft.Json.Linq;
49
using System.Linq;
@@ -16,16 +21,12 @@ public CaseDefinitionsController(ICMMNDefinitionsQueryRepository queryRepository
1621
_queryRepository = queryRepository;
1722
}
1823

19-
[HttpGet]
24+
[HttpGet(".search")]
2025
public async Task<IActionResult> Get()
2126
{
22-
var result = await _queryRepository.GetAll();
23-
return new OkObjectResult(new JArray(result.Select(r => new JObject
24-
{
25-
{ "id", r.id },
26-
{ "name", r.name },
27-
{ "create_datetime", r.creationDate }
28-
})));
27+
var query = HttpContext.Request.Query;
28+
var result = await _queryRepository.Find(ExtractFindParameter(query));
29+
return new OkObjectResult(ToDto(result));
2930
}
3031

3132
[HttpGet("{id}")]
@@ -52,31 +53,61 @@ public async Task<IActionResult> GetCases(string id)
5253
return new OkObjectResult(result.@case);
5354
}
5455

55-
private static JObject ToDto(tDefinitions def)
56+
private static BaseFindParameter ExtractFindParameter(IQueryCollection query)
5657
{
57-
var result = new JObject
58+
int startIndex;
59+
int count;
60+
string orderBy;
61+
FindOrders findOrder;
62+
var parameter = new BaseFindParameter();
63+
if (query.TryGet("start_index", out startIndex))
5864
{
59-
{ "id", def.id },
60-
{ "name", def.name },
61-
{ "create_datetime", def.creationDate },
62-
};
63-
result.Add("cases", ToDto(def.@case));
64-
return result;
65+
parameter.StartIndex = startIndex;
66+
}
67+
68+
if (query.TryGet("count", out count))
69+
{
70+
parameter.Count = count;
71+
}
72+
73+
if (query.TryGet("order_by", out orderBy))
74+
{
75+
parameter.OrderBy = orderBy;
76+
}
77+
78+
if (query.TryGet("order", out findOrder))
79+
{
80+
parameter.Order = findOrder;
81+
}
82+
83+
return parameter;
6584
}
6685

67-
private static JArray ToDto(tCase[] cases)
86+
private static JObject ToDto(FindResponse<tDefinitions> resp)
6887
{
69-
var cmmnCases = new JArray();
70-
foreach (var cmmnCase in cases)
88+
return new JObject
7189
{
72-
cmmnCases.Add(new JObject
90+
{ "start_index", resp.StartIndex },
91+
{ "total_length", resp.TotalLength },
92+
{ "count", resp.Count },
93+
{ "content", new JArray(resp.Content.Select(r => new JObject
7394
{
74-
{ "id", cmmnCase.id },
75-
{ "name", cmmnCase.name }
76-
});
77-
}
95+
{ "id", r.id },
96+
{ "name", r.name },
97+
{ "create_datetime", r.creationDate }
98+
})) }
99+
};
100+
}
78101

79-
return cmmnCases;
102+
private static JObject ToDto(tDefinitions def)
103+
{
104+
return new JObject
105+
{
106+
{ "id", def.id },
107+
{ "name", def.name },
108+
{ "create_datetime", def.creationDate },
109+
{ "xml", new CMMNParser().Serialize(def) }
110+
};
80111
}
81112
}
82113
}

0 commit comments

Comments
 (0)