コード例 #1
0
        public FhirResponse Transaction(Bundle bundle)
        {
            var interactions = localhost.GetInteractions(bundle);

            transfer.Internalize(interactions);

            store.Add(interactions);
            index.Process(interactions);
            return(Respond.Success);

            //return Transaction(interactions);
        }
コード例 #2
0
        public FhirResponse Transaction(Bundle bundle)
        {
            var interactions = localhost.GetEntries(bundle);

            transfer.Internalize(interactions);

            fhirStore.Add(interactions);
            fhirIndex.Process(interactions);
            transfer.Externalize(interactions);

            bundle = localhost.CreateBundle(Bundle.BundleType.TransactionResponse).Append(interactions);

            return(Respond.WithBundle(bundle));
        }
コード例 #3
0
ファイル: FhirService.cs プロジェクト: schellack/spark
        /// <summary>
        /// Create a new resource with a server assigned id.
        /// </summary>
        /// <param name="collection">The resource type, in lowercase</param>
        /// <param name="resource">The data for the Resource to be created</param>
        /// <remarks>
        /// May return:
        ///     201 Created - on successful creation
        /// </remarks>
        public ResourceEntry Create(ResourceEntry entry, string collection, string id = null)
        {
            RequestValidator.ValidateResourceBody(entry, collection);
            importer.AssertIdAllowed(id);
            Uri location = BuildLocation(collection, id ?? generator.NextKey(entry.Resource));

            entry.Id = location;

            importer.Import(entry);
            store.Add(entry);
            index.Process(entry);

            Uri           key    = Key.FromLocation(location);
            ResourceEntry result = (ResourceEntry)store.Get(key);

            exporter.Externalize(result);

            return(result);
        }
コード例 #4
0
ファイル: FhirIndexTest.cs プロジェクト: schellack/spark
        private static void AddTaggedPatient()
        {
            IFhirStore store   = Spark.Store.MongoStoreFactory.GetMongoFhirStore();
            var        patient = new Patient();

            patient.Id   = "Patient/tagged";
            patient.Name = new List <HumanName>();
            patient.Name.Add(new HumanName()
            {
                Given = new string[] { "Truus" }, Family = new string[] { "Tagged" }
            });
            ResourceEntry patientRE = ResourceEntry.Create(patient);

            patientRE.Id       = new Uri("Patient/tagged", UriKind.Relative);
            patientRE.SelfLink = new Uri("Patient/tagged", UriKind.Relative);
            patientRE.Tags.Add(new Tag(_otherTag, Tag.FHIRTAGSCHEME_GENERAL, "dummy"));
            store.Add(patientRE);
            index.Process(patientRE);
        }
コード例 #5
0
        public Entry Add(Entry entry)
        {
            if (entry.State != EntryState.Internal)
            {
                transfer.Internalize(entry);
            }
            fhirStore.Add(entry);
            Entry result;

            if (entry.IsDelete)
            {
                result = entry;
            }
            else
            {
                result = fhirStore.Get(entry.Key);
            }
            transfer.Externalize(result);

            return(result);
        }
コード例 #6
0
        public async Task <Entry> Add(Entry entry)
        {
            if (entry.State != EntryState.Internal)
            {
                await _transfer.Internalize(entry).ConfigureAwait(false);
            }

            await _fhirStore.Add(entry).ConfigureAwait(false);

            Entry result;

            if (entry.IsDelete)
            {
                result = entry;
            }
            else
            {
                result = await _fhirStore.Get(entry.Key).ConfigureAwait(false);
            }

            _transfer.Externalize(result);

            return(result);
        }