-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
568ca5d
commit 23667f7
Showing
13 changed files
with
92 additions
and
21 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
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
45 changes: 45 additions & 0 deletions
45
.../src/Equinor.ProjectExecutionPortal.Application/Services/ContextService/ContextService.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,45 @@ | ||
using Equinor.ProjectExecutionPortal.Application.Queries.OnboardedContexts; | ||
using Fusion.Integration; | ||
|
||
namespace Equinor.ProjectExecutionPortal.Application.Services.ContextService | ||
{ | ||
public class ContextService : IContextService | ||
{ | ||
private readonly IFusionContextResolver _fusionContextResolver; | ||
|
||
|
||
public ContextService(IFusionContextResolver contextResolver) | ||
{ | ||
_fusionContextResolver = contextResolver; | ||
} | ||
|
||
public async Task<OnboardedContextDto> EnrichContextWithFusionContextData(OnboardedContextDto context, CancellationToken cancellationToken) | ||
{ | ||
var contextIdentifier = ContextIdentifier.FromExternalId(context.ExternalId); | ||
var fusionContext = await _fusionContextResolver.ResolveContextAsync(contextIdentifier); | ||
|
||
if (fusionContext != null) | ||
{ | ||
context.SupplyWithFusionData(fusionContext); | ||
} | ||
|
||
return context; | ||
} | ||
|
||
public async Task<IList<OnboardedContextDto>> EnrichContextsWithFusionContextData(IList<OnboardedContextDto> contexts, CancellationToken cancellationToken) | ||
{ | ||
foreach (var onboardedContextDto in contexts) | ||
{ | ||
var contextIdentifier = ContextIdentifier.FromExternalId(onboardedContextDto.ExternalId); | ||
var fusionContext = await _fusionContextResolver.ResolveContextAsync(contextIdentifier); | ||
|
||
if (fusionContext != null) | ||
{ | ||
onboardedContextDto.SupplyWithFusionData(fusionContext); | ||
} | ||
} | ||
|
||
return contexts; | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...src/Equinor.ProjectExecutionPortal.Application/Services/ContextService/IContextService.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,10 @@ | ||
using Equinor.ProjectExecutionPortal.Application.Queries.OnboardedContexts; | ||
|
||
namespace Equinor.ProjectExecutionPortal.Application.Services.ContextService | ||
{ | ||
public interface IContextService | ||
{ | ||
Task<OnboardedContextDto> EnrichContextWithFusionContextData(OnboardedContextDto context, CancellationToken cancellationToken); | ||
Task<IList<OnboardedContextDto>> EnrichContextsWithFusionContextData(IList <OnboardedContextDto> contexts, CancellationToken cancellationToken); | ||
} | ||
} |
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
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