-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create orchestration for brs21 metered data (#31)
* Added initial BRS021 models and classes Co-authored-by: Anders Balling Petersen <[email protected]>
- Loading branch information
Showing
9 changed files
with
195 additions
and
1 deletion.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
docs/ProcessManager.Orchestrations.Abstractions/ReleaseNotes/ReleaseNotes.md
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
20 changes: 20 additions & 0 deletions
20
...stractions/Processes/BRS_021/ForwardMeteredData/V1/Model/Brs_021_ForwardMeteredData_V1.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,20 @@ | ||
// Copyright 2020 Energinet DataHub A/S | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License2"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using Energinet.DataHub.ProcessManager.Abstractions.Api.Model.OrchestrationDescription; | ||
|
||
namespace Energinet.DataHub.ProcessManager.Orchestrations.Abstractions.Processes.BRS_021.ForwardMeteredData.V1.Model; | ||
|
||
public record Brs_021_ForwardedMeteredData_V1() | ||
: OrchestrationDescriptionUniqueNameDto("BRS_021_ForwardMeteredData", 1); |
20 changes: 20 additions & 0 deletions
20
...strations.Abstractions/Processes/BRS_021/ForwardMeteredData/V1/Model/EnergyObservation.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,20 @@ | ||
// Copyright 2020 Energinet DataHub A/S | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License2"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace Energinet.DataHub.ProcessManager.Orchestrations.Abstractions.Processes.BRS_021.ForwardMeteredData.V1.Model; | ||
|
||
public record EnergyObservation( | ||
string? Position, | ||
string? EnergyQuantity, | ||
string? QuantityQuality); |
36 changes: 36 additions & 0 deletions
36
...esses/BRS_021/ForwardMeteredData/V1/Model/MeteredDataForMeasurementPointMessageInputV1.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,36 @@ | ||
// Copyright 2020 Energinet DataHub A/S | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License2"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using Energinet.DataHub.ProcessManager.Abstractions.Api.Model; | ||
|
||
namespace Energinet.DataHub.ProcessManager.Orchestrations.Abstractions.Processes.BRS_021.ForwardMeteredData.V1.Model; | ||
|
||
/// <summary> | ||
/// An immutable input to start the orchestration instance for "BRS_021_ForwardMeteredData" V1. | ||
/// </summary> | ||
public record MeteredDataForMeasurementPointMessageInputV1( | ||
Guid AuthenticatedActorId, | ||
string TransactionId, | ||
string? MeteringPointId, | ||
string? MeteringPointType, | ||
string? ProductNumber, | ||
string? MeasureUnit, | ||
string RegistrationDateTime, | ||
string? Resolution, | ||
string StartDateTime, | ||
string? EndDateTime, | ||
string GridAccessProviderNumber, | ||
IReadOnlyCollection<string>? DelegatedGridAreaCodes, | ||
IReadOnlyCollection<EnergyObservation> EnergyObservations) | ||
: IInputParameterDto; |
41 changes: 41 additions & 0 deletions
41
...actions/Processes/BRS_021/ForwardMeteredData/V1/Model/StartMeteredDataForwardCommandV1.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,41 @@ | ||
// Copyright 2020 Energinet DataHub A/S | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License2"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using Energinet.DataHub.ProcessManager.Abstractions.Api.Model; | ||
using Energinet.DataHub.ProcessManager.Abstractions.Api.Model.OrchestrationInstance; | ||
|
||
namespace Energinet.DataHub.ProcessManager.Orchestrations.Abstractions.Processes.BRS_021.ForwardMeteredData.V1.Model; | ||
|
||
/// <summary> | ||
/// Command for starting a BRS-021-ForwardMeteredData. | ||
/// Must be JSON serializable. | ||
/// </summary> | ||
public record StartForwardMeteredDataCommandV1 | ||
: StartOrchestrationInstanceCommand<ActorIdentityDto, MeteredDataForMeasurementPointMessageInputV1> | ||
{ | ||
/// <summary> | ||
/// Construct command. | ||
/// </summary> | ||
/// <param name="operatingIdentity">Identity of the user executing the command.</param> | ||
/// <param name="inputParameter">Contains the Durable Functions orchestration input parameter value.</param> | ||
public StartForwardMeteredDataCommandV1( | ||
ActorIdentityDto operatingIdentity, | ||
MeteredDataForMeasurementPointMessageInputV1 inputParameter) | ||
: base( | ||
operatingIdentity, | ||
orchestrationDescriptionUniqueName: new Brs_021_ForwardedMeteredData_V1(), | ||
inputParameter) | ||
{ | ||
} | ||
} |
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
47 changes: 47 additions & 0 deletions
47
...ns/Processes/BRS_021/ForwardMeteredData/V1/Orchestration_Brs_021_ForwardMeteredData_V1.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,47 @@ | ||
// Copyright 2020 Energinet DataHub A/S | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License2"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using Energinet.DataHub.ProcessManagement.Core.Infrastructure.Extensions.DurableTask; | ||
using Energinet.DataHub.ProcessManager.Orchestrations.Abstractions.Processes.BRS_021.ForwardMeteredData.V1.Model; | ||
using Microsoft.Azure.Functions.Worker; | ||
using Microsoft.DurableTask; | ||
|
||
namespace Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_021.ForwardMeteredData.V1; | ||
|
||
internal class Orchestration_Brs_021_ForwardMeteredData_V1 | ||
{ | ||
internal const int ValidatingStep = 1; | ||
internal const int StoringMeteredDataStep = 2; | ||
internal const int FindReceiverStep = 3; | ||
internal const int EnqueueMessagesStep = 4; | ||
|
||
[Function(nameof(Orchestration_Brs_021_ForwardMeteredData_V1))] | ||
public async Task<string> Run( | ||
[OrchestrationTrigger] TaskOrchestrationContext context) | ||
{ | ||
var input = context.GetOrchestrationParameterValue<MeteredDataForMeasurementPointMessageInputV1>(); | ||
|
||
if (input == null) | ||
return "Error: No input specified."; | ||
|
||
await Task.CompletedTask; | ||
|
||
/* | ||
* Activities: | ||
*/ | ||
// TODO: Implementing activities coming in next PR. | ||
|
||
return "Success"; | ||
} | ||
} |
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