Exemple #1
0
        /// <summary>
        /// Update a patient
        /// </summary>
        public SVC.Messaging.FHIR.FhirOperationResult Update(string id, SVC.Messaging.FHIR.Resources.ResourceBase target, SVC.Core.Services.DataPersistenceMode mode)
        {
            // Create a registration event ... subject
            FhirOperationResult retVal = new FhirOperationResult();

            retVal.Details = new List <IResultDetail>();

            // Get query parameters
            var resourceProcessor = FhirMessageProcessorUtil.GetMessageProcessor(this.ResourceName);

            // Parse the incoming request
            if (target != null)
            {
                target.Id = id;
            }
            var storeContainer = resourceProcessor.ProcessResource(target, retVal.Details);

            if (storeContainer == null)
            {
                retVal.Outcome = ResultCode.AcceptedNonConformant;
            }
            else
            {
                // Now store the container
                try
                {
                    // HACK: Store the container
                    storeContainer = DataUtil.Update(storeContainer, id, mode, retVal.Details);

                    retVal.Outcome = ResultCode.Accepted;
                    retVal.Results = new List <ResourceBase>();
                    retVal.Results.Add(resourceProcessor.ProcessComponent(storeContainer, retVal.Details));
                }
                catch (MissingPrimaryKeyException e)
                {
                    retVal.Details.Add(new ResultDetail(ResultDetailType.Error, e.Message, e));
                    retVal.Outcome = ResultCode.TypeNotAvailable;
                    throw e;
                }
                catch (Exception e)
                {
                    retVal.Details.Add(new ResultDetail(ResultDetailType.Error, ApplicationContext.LocalizationService.GetString("DTPE001"), e));
                    retVal.Outcome = ResultCode.Error;
                }
            }
            return(retVal);
        }
 /// <summary>
 /// Process a resource
 /// </summary>
 public override System.ComponentModel.IComponent ProcessResource(SVC.Messaging.FHIR.Resources.ResourceBase resource, List <Everest.Connectors.IResultDetail> dtls)
 {
     throw new NotSupportedException();
 }