public static void Append(this Bundle bundle, Bundle.HTTPVerb method, IEnumerable <Resource> resources) { foreach (Resource resource in resources) { bundle.Append(method, resource); } }
private Bundle.EntryComponent newEntry(Bundle.HTTPVerb method) { var newEntry = new Bundle.EntryComponent(); newEntry.Request = new Bundle.RequestComponent(); newEntry.Request.Method = method; return(newEntry); }
public static ResourceManipulationOperation GetManipulationOperation(Bundle.EntryComponent entryComponent, ILocalhost localhost, ISearchService service = null) { searchService = service; Bundle.HTTPVerb method = localhost.ExtrapolateMethod(entryComponent, null); //CCR: is key needed? Isn't method required? Key key = localhost.ExtractKey(entryComponent); var searchUri = GetSearchUri(entryComponent, method); return(builders[method](entryComponent.Resource, key, service, searchUri != null? ParseQueryString(localhost, searchUri): null)); }
private Bundle.BundleEntryComponent newEntry(Bundle.HTTPVerb method) { var newEntry = new Bundle.BundleEntryComponent(); newEntry.Transaction = new Bundle.BundleEntryTransactionComponent(); newEntry.Transaction.Method = method; return(newEntry); }
public static void Append(this Bundle bundle, Bundle.HTTPVerb method, Resource resource) { var entry = CreateEntryForResource(resource); entry.Request ??= new Bundle.RequestComponent(); entry.Request.Method = method; bundle.Entry.Add(entry); }
private Bundle.EntryComponent newEntry(Bundle.HTTPVerb method, InteractionType interactionType) { var newEntry = new Bundle.EntryComponent(); newEntry.Request = new Bundle.RequestComponent(); newEntry.Request.Method = method; newEntry.AddAnnotation(interactionType); return(newEntry); }
public static Entry ExtractMetadata(BsonDocument document) { DateTime when = GetVersionDate(document); IKey key = GetKey(document); Bundle.HTTPVerb method = (Bundle.HTTPVerb)(int) document[Field.METHOD]; RemoveMetadata(document); return(Entry.Create(method, key, when)); }
public static void Append(this Bundle bundle, Bundle.HTTPVerb method, Resource resource) { Bundle.EntryComponent entry = CreateEntryForResource(resource); if (entry.Request == null) { entry.Request = new Bundle.RequestComponent(); } entry.Request.Method = method; bundle.Entry.Add(entry); }
private static Uri GetSearchUri(Bundle.EntryComponent entryComponent, Bundle.HTTPVerb method) { var searchUri = method switch { Bundle.HTTPVerb.POST => PostManipulationOperation.ReadSearchUri(entryComponent), Bundle.HTTPVerb.PUT => PutManipulationOperation.ReadSearchUri(entryComponent), Bundle.HTTPVerb.DELETE => DeleteManipulationOperation.ReadSearchUri(entryComponent), _ => null }; return(searchUri); }
public static void Append(this Bundle bundle, Bundle.HTTPVerb method, Resource resource) { var entry = new Bundle.BundleEntryComponent(); entry.Resource = resource; entry.Base = bundle.Base; if (entry.Transaction == null) { entry.Transaction = new Bundle.BundleEntryTransactionComponent(); } entry.Transaction.Method = method; bundle.Entry.Add(entry); }
public static Interaction ToInteraction(this ILocalhost localhost, Bundle.BundleEntryComponent bundleEntry) { Key key = localhost.ExtractKey(bundleEntry); Bundle.HTTPVerb method = localhost.ExtrapolateMethod(bundleEntry, key); if (key != null) { return(Interaction.Create(method, key, bundleEntry.Resource)); } else { return(Interaction.Create(method, bundleEntry.Resource)); } }
protected Entry(Bundle.HTTPVerb method, IKey key, DateTimeOffset?when, Resource resource) { if (resource != null) { key.ApplyTo(resource); } else { this.Key = key; } this.Resource = resource; this.Method = method; this.When = when ?? DateTimeOffset.Now; this.State = EntryState.Undefined; }
private static Uri GetSearchUri(Bundle.EntryComponent entryComponent, Bundle.HTTPVerb method) { Uri searchUri = null; if (method == Bundle.HTTPVerb.POST) { searchUri = PostManipulationOperation.ReadSearchUri(entryComponent); } else if (method == Bundle.HTTPVerb.PUT) { searchUri = PutManipulationOperation.ReadSearchUri(entryComponent); } else if (method == Bundle.HTTPVerb.DELETE) { searchUri = DeleteManipulationOperation.ReadSearchUri(entryComponent); } return(searchUri); }
public static void SetResourceBaseAddOrUpdate <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType>(Resource Resource, ResourceCurrentBase <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> ResourceCurrentBase, string Version, bool IsDeleted, Bundle.HTTPVerb Method, int FhirReleaseId) where ResCurrentType : ResourceCurrentBase <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexStringType : ResourceIndexString <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexTokenType : ResourceIndexToken <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexUriType : ResourceIndexUri <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexReferenceType : ResourceIndexReference <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexQuantityType : ResourceIndexQuantity <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexDateTimeType : ResourceIndexDateTime <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> { SetResourceBase(Resource, ResourceCurrentBase, null, Version, false, Method, FhirReleaseId); }
private static void SetResourceBase <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType>(Resource Resource, ResourceCurrentBase <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> ResourceCurrentBase, string FhirResourceId, string Version, bool IsDeleted, Bundle.HTTPVerb Method, int FhirReleaseId) where ResCurrentType : ResourceCurrentBase <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexStringType : ResourceIndexString <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexTokenType : ResourceIndexToken <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexUriType : ResourceIndexUri <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexReferenceType : ResourceIndexReference <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexQuantityType : ResourceIndexQuantity <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexDateTimeType : ResourceIndexDateTime <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> { ResourceCurrentBase.FhirReleaseId = FhirReleaseId; ResourceCurrentBase.IsDeleted = IsDeleted; ResourceCurrentBase.VersionId = Version; ResourceCurrentBase.Method = Method; if (!IsDeleted) { ResourceCurrentBase.FhirId = Resource.Id; Hl7.Fhir.Serialization.FhirXmlSerializer FhirXmlSerializer = new Hl7.Fhir.Serialization.FhirXmlSerializer(); ResourceCurrentBase.Resource = Common.Tools.GZip.GZipper.Compress(FhirXmlSerializer.SerializeToBytes(Resource)); ResourceCurrentBase.LastUpdated = (DateTimeOffset)Resource.Meta.LastUpdated; // Zip to byte[] //byte[] CompressedBytes = Common.Tools.GZip.GZipper.Compress(FhirXmlSerializer.SerializeToBytes(Resource)); //string ResourceString = Common.Tools.GZip.GZipper.Decompress(CompressedBytes); } else { ResourceCurrentBase.FhirId = FhirResourceId; ResourceCurrentBase.Resource = null; ResourceCurrentBase.LastUpdated = DateTimeOffset.Now; } }
public static Interaction Create(Bundle.HTTPVerb method, IKey key, DateTimeOffset when) { return(new Interaction(method, key, when, null)); }
public static Entry Create(Bundle.HTTPVerb method, IKey key, DateTimeOffset when) { return(new Entry(method, key, when, null)); }
public static Interaction Create(Bundle.HTTPVerb method, IKey key, Resource resource) { return(new Interaction(method, key, null, resource)); }
public static Entry Create(Bundle.HTTPVerb method, Resource resource) { return(new Entry(method, null, null, resource)); }
private static void SetResourceBase <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType>(Resource Resource, ResourceCurrentBase <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> ResourceCurrentBase, string FhirResourceId, string Version, bool IsDeleted, Bundle.HTTPVerb Method, int FhirReleaseId) where ResCurrentType : ResourceCurrentBase <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexStringType : ResourceIndexString <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexTokenType : ResourceIndexToken <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexUriType : ResourceIndexUri <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexReferenceType : ResourceIndexReference <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexQuantityType : ResourceIndexQuantity <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> where ResIndexDateTimeType : ResourceIndexDateTime <ResCurrentType, ResIndexStringType, ResIndexTokenType, ResIndexUriType, ResIndexReferenceType, ResIndexQuantityType, ResIndexDateTimeType> { ResourceCurrentBase.FhirReleaseId = FhirReleaseId; ResourceCurrentBase.IsDeleted = IsDeleted; ResourceCurrentBase.VersionId = Version; ResourceCurrentBase.Method = Method; if (!IsDeleted) { ResourceCurrentBase.FhirId = Resource.Id; Hl7.Fhir.Serialization.FhirXmlSerializer FhirXmlSerializer = new Hl7.Fhir.Serialization.FhirXmlSerializer(); ResourceCurrentBase.XmlBlob = FhirXmlSerializer.SerializeToString(Resource); //Now obsolete in FHIR .NET API //ResourceCurrentBase.XmlBlob = Hl7.Fhir.Serialization.FhirSerializer.SerializeResourceToXml(Resource); ResourceCurrentBase.LastUpdated = (DateTimeOffset)Resource.Meta.LastUpdated; } else { ResourceCurrentBase.FhirId = FhirResourceId; ResourceCurrentBase.XmlBlob = ""; ResourceCurrentBase.LastUpdated = DateTimeOffset.Now; } }