private async Task <FhirResponse> HandleOperation( ResourceManipulationOperation operation, IInteractionHandler interactionHandler, Mapper <string, IKey> mapper = null) { IList <Entry> interactions = operation.GetEntries().ToList(); if (mapper != null) { await _transfer.Internalize(interactions, mapper).ConfigureAwait(false); } FhirResponse response = null; foreach (var interaction in interactions) { response = MergeFhirResponse( response, await interactionHandler.HandleInteraction(interaction).ConfigureAwait(false)); if (!response.IsValid) { throw new Exception(); } interaction.Resource = response.Resource; } _transfer.Externalize(interactions); return(response); }
public FhirResponse HandleOperation(ResourceManipulationOperation operation, IInteractionHandler interactionHandler, Mapper <string, IKey> mapper = null) { IList <Entry> interactions = operation.GetEntries().ToList(); if (mapper != null) { transfer.Internalize(interactions, mapper); } FhirResponse response = null; foreach (Entry interaction in interactions) { response = MergeFhirResponse(response, interactionHandler.HandleInteraction(interaction)); if (!response.IsValid) { throw new Exception(); } interaction.Resource = response.Resource; } transfer.Externalize(interactions); return(response); }
private void AddMappingsForOperation( Mapper <string, IKey> mapper, ResourceManipulationOperation operation, IList <Entry> interactions) { if (mapper == null || interactions.Count != 1) { return; } var entry = interactions[0]; if (!entry.Key.Equals(operation.OperationKey)) { mapper.Remap( _localhost.GetKeyKind(operation.OperationKey) == KeyKind.Temporary ? operation.OperationKey.ResourceId : operation.OperationKey.ToString(), entry.Key.WithoutVersion()); } }
private void AddMappingsForOperation(Mapper <string, IKey> mapper, ResourceManipulationOperation operation, IList <Entry> interactions) { if (mapper == null) { return; } if (interactions.Count() == 1) { Entry entry = interactions.First(); if (!entry.Key.Equals(operation.OperationKey)) { if (localhost.GetKeyKind(operation.OperationKey) == KeyKind.Temporary) { mapper.Remap(operation.OperationKey.ResourceId, entry.Key.WithoutVersion()); } else { mapper.Remap(operation.OperationKey.ToString(), entry.Key.WithoutVersion()); } } } }
public Task <FhirResponse> HandleTransaction( ResourceManipulationOperation operation, IInteractionHandler interactionHandler) => HandleOperation(operation, interactionHandler);
public FhirResponse HandleTransaction(ResourceManipulationOperation operation, IInteractionHandler interactionHandler) { return(HandleOperation(operation, interactionHandler)); }