示例#1
0
        public static async Task SynchronizePropertiesAsync <T>(T component, FhirTransactionContext context, Action <T, FhirTransactionContext> synchronizeAction, bool requiredProperty, bool enforceAllFields, IExceptionStore exceptionStore, CancellationToken cancellationToken = default)
        {
            EnsureArg.IsNotNull(context, nameof(context));
            EnsureArg.IsNotNull(synchronizeAction, nameof(synchronizeAction));
            EnsureArg.IsNotNull(exceptionStore, nameof(exceptionStore));

            try
            {
                synchronizeAction(component, context);
            }
            catch (DicomTagException ex)
            {
                if (!enforceAllFields && !requiredProperty)
                {
                    await exceptionStore.WriteExceptionAsync(
                        context.ChangeFeedEntry,
                        ex,
                        ErrorType.DicomValidationError,
                        cancellationToken);
                }
                else
                {
                    throw;
                }
            }
        }
示例#2
0
        /// <inheritdoc/>
        public async Task SynchronizeAsync(FhirTransactionContext context, Patient patient, bool isNewPatient, CancellationToken cancellationToken)
        {
            EnsureArg.IsNotNull(context, nameof(context));
            EnsureArg.IsNotNull(patient, nameof(patient));

            DicomDataset dataset = context.ChangeFeedEntry.Metadata;

            foreach (IPatientPropertySynchronizer patientPropertySynchronizer in _patientPropertySynchronizers)
            {
                try
                {
                    patientPropertySynchronizer.Synchronize(dataset, patient, isNewPatient);
                }
                catch (DicomTagException ex)
                {
                    if (_dicomCastconfiguration.Features.IgnoreSyncOfInvalidTagValue)
                    {
                        await _exceptionStore.WriteExceptionAsync(
                            context.ChangeFeedEntry,
                            ex,
                            ErrorType.DicomValidationError,
                            cancellationToken);
                    }
                    else
                    {
                        throw;
                    }
                }
            }
        }
示例#3
0
 public static async Task SynchronizePropertiesAsync <T>(T component, FhirTransactionContext context, Action <T, FhirTransactionContext> synchronizeAction, bool requiredProperty, bool partialValidation, IExceptionStore exceptionStore, CancellationToken cancellationToken = default)
 {
     try
     {
         synchronizeAction(component, context);
     }
     catch (DicomTagException ex)
     {
         if (partialValidation && !requiredProperty)
         {
             await exceptionStore.WriteExceptionAsync(
                 context.ChangeFeedEntry,
                 ex,
                 ErrorType.DicomValidationError,
                 cancellationToken);
         }
         else
         {
             throw;
         }
     }
 }