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); }
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)); }
/// <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); }
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); }
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); }
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); }