-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from Worth-NL/feature/TaskScenario_SupportAlte…
…rnativeTaskObjectPOCO Feature/task scenario support alternative task object poco
- Loading branch information
Showing
36 changed files
with
669 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# **OMC** Documentation | ||
|
||
v.1.8.14 | ||
v.1.8.15 | ||
|
||
© 2024, Worth Systems. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
EventsHandler/Api/EventsHandler/Mapping/Enums/Objecten/vNijmegen/Registrations.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// © 2024, Worth Systems. | ||
|
||
using EventsHandler.Constants; | ||
using EventsHandler.Mapping.Converters; | ||
using EventsHandler.Mapping.Models.POCOs.Objecten.Task.vNijmegen; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace EventsHandler.Mapping.Enums.Objecten.vNijmegen | ||
{ | ||
/// <summary> | ||
/// The type of the <see cref="Coupling"/> from "Objecten" Web API service. | ||
/// </summary> | ||
[JsonConverter(typeof(SafeJsonStringEnumMemberConverter<Registrations>))] | ||
public enum Registrations | ||
{ | ||
/// <summary> | ||
/// The default value. | ||
/// </summary> | ||
[JsonPropertyName(DefaultValues.Models.DefaultEnumValueName)] | ||
Unknown = 0, | ||
|
||
/// <summary> | ||
/// The case type of the <see cref="Coupling"/>. | ||
/// </summary> | ||
[JsonPropertyName("zaak")] | ||
Case = 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
EventsHandler/Api/EventsHandler/Mapping/Models/POCOs/Objecten/Task/CommonTaskData.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// © 2024, Worth Systems. | ||
|
||
using EventsHandler.Mapping.Enums.Objecten; | ||
using EventsHandler.Mapping.Models.Interfaces; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace EventsHandler.Mapping.Models.POCOs.Objecten.Task | ||
{ | ||
/// <summary> | ||
/// The data related to the Task (from vHague or vNijmegen versions) retrieved from "Objecten" Web API service. | ||
/// </summary> | ||
/// <remarks> | ||
/// Common DTO for all versions of "Objecten" Web API service. | ||
/// </remarks> | ||
/// <seealso cref="IJsonSerializable"/> | ||
internal readonly struct CommonTaskData : IJsonSerializable | ||
{ | ||
/// <summary> | ||
/// The reference to related object in <see cref="System.Uri"/> format: | ||
/// <code> | ||
/// http(s)://Domain/ApiEndpoint/[UUID] | ||
/// </code> | ||
/// </summary> | ||
[JsonInclude] | ||
[JsonPropertyOrder(0)] | ||
internal Uri CaseUri { get; init; } // NOTE: Some task data might not have it (recreating of URI is necessary) | ||
|
||
/// <summary> | ||
/// The ID of the related object. | ||
/// </summary> | ||
[JsonRequired] | ||
[JsonInclude] | ||
[JsonPropertyOrder(1)] | ||
internal Guid CaseId { get; init; } | ||
|
||
/// <summary> | ||
/// The title of the task. | ||
/// </summary> | ||
[JsonRequired] | ||
[JsonInclude] | ||
[JsonPropertyOrder(2)] | ||
internal string Title { get; init; } | ||
|
||
/// <summary> | ||
/// The status of the task. | ||
/// </summary> | ||
[JsonRequired] | ||
[JsonInclude] | ||
[JsonPropertyOrder(3)] | ||
internal TaskStatuses Status { get; init; } | ||
|
||
/// <summary> | ||
/// The deadline by which the task should be completed. | ||
/// </summary> | ||
[JsonRequired] | ||
[JsonInclude] | ||
[JsonPropertyOrder(4)] | ||
internal DateTime ExpirationDate { get; init; } | ||
|
||
/// <summary> | ||
/// The identification details of the task. | ||
/// </summary> | ||
[JsonRequired] | ||
[JsonInclude] | ||
[JsonPropertyOrder(5)] | ||
internal Identification Identification { get; init; } | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...pi/EventsHandler/Mapping/Models/POCOs/Objecten/Task/Converters/CommonTaskDataConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// © 2024, Worth Systems. | ||
|
||
using EventsHandler.Extensions; | ||
using EventsHandler.Services.Settings.Extensions; | ||
using ConfigurationExtensions = EventsHandler.Services.Settings.Extensions.ConfigurationExtensions; | ||
|
||
namespace EventsHandler.Mapping.Models.POCOs.Objecten.Task.Converters | ||
{ | ||
/// <summary> | ||
/// Converts task data from different versions of "Objecten" into a unified <see cref="CommonTaskData"/>. | ||
/// </summary> | ||
internal static class CommonTaskDataConverter | ||
{ | ||
/// <summary> | ||
/// Converts <see cref="vHague.TaskObject"/> (version used by The Hague) from "Objecten" Web API service. | ||
/// </summary> | ||
/// <returns> | ||
/// The unified <see cref="CommonTaskData"/> DTO model. | ||
/// </returns> | ||
internal static CommonTaskData ConvertToUnified(this vHague.TaskObject taskDataHague) | ||
{ | ||
return new CommonTaskData | ||
{ | ||
CaseUri = taskDataHague.Record.Data.CaseUri, | ||
CaseId = taskDataHague.Record.Data.CaseUri.GetGuid(), // NOTE: URI is given, GUID needs to be extracted | ||
Title = taskDataHague.Record.Data.Title, | ||
Status = taskDataHague.Record.Data.Status, | ||
ExpirationDate = taskDataHague.Record.Data.ExpirationDate, | ||
Identification = taskDataHague.Record.Data.Identification | ||
}; | ||
} | ||
|
||
/// <summary> | ||
/// Converts <see cref="vNijmegen.TaskObject"/> (version used by Nijmegen) from "Objecten" Web API service. | ||
/// </summary> | ||
/// <returns> | ||
/// The unified <see cref="CommonTaskData"/> DTO model. | ||
/// </returns> | ||
internal static CommonTaskData ConvertToUnified(this vNijmegen.TaskObject taskNijmegen) | ||
{ | ||
return new CommonTaskData | ||
{ | ||
CaseUri = RecreateCaseUri(taskNijmegen.Record.Data.Coupling.Id), // NOTE: GUID is given, URI needs to be recreated | ||
CaseId = taskNijmegen.Record.Data.Coupling.Id, | ||
Title = taskNijmegen.Record.Data.Title, | ||
Status = taskNijmegen.Record.Data.Status, | ||
ExpirationDate = taskNijmegen.Record.Data.ExpirationDate, | ||
Identification = taskNijmegen.Record.Data.Identification | ||
}; | ||
} | ||
|
||
#region Helper methods | ||
private const string CaseUri = "https://{0}/zaken/api/v1/zaken/{1}"; | ||
|
||
private static Uri RecreateCaseUri(Guid caseId) | ||
=> string.Format(CaseUri, ConfigurationExtensions.OpenZaakDomain(), caseId) | ||
.GetValidUri(); | ||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
EventsHandler/Api/EventsHandler/Mapping/Models/POCOs/Objecten/Task/vNijmegen/Coupling.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// © 2024, Worth Systems. | ||
|
||
using EventsHandler.Mapping.Enums.Objecten.vNijmegen; | ||
using EventsHandler.Mapping.Models.Interfaces; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace EventsHandler.Mapping.Models.POCOs.Objecten.Task.vNijmegen | ||
{ | ||
/// <summary> | ||
/// The coupling related to the <see cref="TaskObject"/> retrieved from "Objecten" Web API service. | ||
/// </summary> | ||
/// <seealso cref="IJsonSerializable"/> | ||
public struct Coupling : IJsonSerializable | ||
{ | ||
/// <summary> | ||
/// The type of the <see cref="Coupling"/>. | ||
/// </summary> | ||
[JsonRequired] | ||
[JsonInclude] | ||
[JsonPropertyName("registratie")] | ||
[JsonPropertyOrder(0)] | ||
public Registrations Type { get; internal set; } | ||
|
||
/// <summary> | ||
/// The ID of the <see cref="Coupling"/> object (e.g., case). | ||
/// </summary> | ||
[JsonRequired] | ||
[JsonInclude] | ||
[JsonPropertyName("uuid")] | ||
[JsonPropertyOrder(1)] | ||
public Guid Id { get; internal set; } = Guid.Empty; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Coupling"/> struct. | ||
/// </summary> | ||
public Coupling() | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.