public static void SerializeCodeableConcept(Hl7.Fhir.Model.CodeableConcept value, IFhirWriter writer, bool summary) { writer.WriteStartComplexContent(); // Serialize element _id if (value.LocalIdElement != null) { writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute); } // Serialize element extension if (value.Extension != null && !summary && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element coding if (value.Coding != null && value.Coding.Count > 0) { writer.WriteStartArrayElement("coding"); foreach (var item in value.Coding) { writer.WriteStartArrayMember("coding"); CodingSerializer.SerializeCoding(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element text if (value.TextElement != null) { writer.WriteStartElement("text"); FhirStringSerializer.SerializeFhirString(value.TextElement, writer, summary); writer.WriteEndElement(); } // Serialize element primary if (value.PrimaryElement != null) { writer.WriteStartElement("primary"); IdRefSerializer.SerializeIdRef(value.PrimaryElement, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeProtocolStepNextComponent(Hl7.Fhir.Model.Protocol.ProtocolStepNextComponent value, IFhirWriter writer) { writer.WriteStartComplexContent(); // Serialize element extension if (value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element _id if (value.LocalId != null) { writer.WriteStartElement("_id"); IdSerializer.SerializeId(value.LocalId, writer); writer.WriteEndElement(); } // Serialize element description if (value.Description != null) { writer.WriteStartElement("description"); FhirStringSerializer.SerializeFhirString(value.Description, writer); writer.WriteEndElement(); } // Serialize element id if (value.Id != null) { writer.WriteStartElement("id"); IdRefSerializer.SerializeIdRef(value.Id, writer); writer.WriteEndElement(); } // Serialize element condition if (value.Condition != null) { writer.WriteStartElement("condition"); ProtocolSerializer.SerializeProtocolStepPreconditionComponent(value.Condition, writer); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeProtocolStepActivityComponentComponent(Hl7.Fhir.Model.Protocol.ProtocolStepActivityComponentComponent value, IFhirWriter writer) { writer.WriteStartComplexContent(); // Serialize element extension if (value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element _id if (value.LocalId != null) { writer.WriteStartElement("_id"); IdSerializer.SerializeId(value.LocalId, writer); writer.WriteEndElement(); } // Serialize element sequence if (value.Sequence != null) { writer.WriteStartElement("sequence"); IntegerSerializer.SerializeInteger(value.Sequence, writer); writer.WriteEndElement(); } // Serialize element activity if (value.Activity != null) { writer.WriteStartElement("activity"); IdRefSerializer.SerializeIdRef(value.Activity, writer); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeProtocolStepComponent(Hl7.Fhir.Model.Protocol.ProtocolStepComponent value, IFhirWriter writer) { writer.WriteStartComplexContent(); // Serialize element extension if (value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element _id if (value.LocalId != null) { writer.WriteStartElement("_id"); IdSerializer.SerializeId(value.LocalId, writer); writer.WriteEndElement(); } // Serialize element name if (value.Name != null) { writer.WriteStartElement("name"); FhirStringSerializer.SerializeFhirString(value.Name, writer); writer.WriteEndElement(); } // Serialize element description if (value.Description != null) { writer.WriteStartElement("description"); FhirStringSerializer.SerializeFhirString(value.Description, writer); writer.WriteEndElement(); } // Serialize element duration if (value.Duration != null) { writer.WriteStartElement("duration"); QuantitySerializer.SerializeQuantity(value.Duration, writer); writer.WriteEndElement(); } // Serialize element precondition if (value.Precondition != null) { writer.WriteStartElement("precondition"); ProtocolSerializer.SerializeProtocolStepPreconditionComponent(value.Precondition, writer); writer.WriteEndElement(); } // Serialize element exit if (value.Exit != null) { writer.WriteStartElement("exit"); ProtocolSerializer.SerializeProtocolStepPreconditionComponent(value.Exit, writer); writer.WriteEndElement(); } // Serialize element firstActivity if (value.FirstActivity != null) { writer.WriteStartElement("firstActivity"); IdRefSerializer.SerializeIdRef(value.FirstActivity, writer); writer.WriteEndElement(); } // Serialize element activity if (value.Activity != null && value.Activity.Count > 0) { writer.WriteStartArrayElement("activity"); foreach (var item in value.Activity) { writer.WriteStartArrayMember("activity"); ProtocolSerializer.SerializeProtocolStepActivityComponent(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element next if (value.Next != null && value.Next.Count > 0) { writer.WriteStartArrayElement("next"); foreach (var item in value.Next) { writer.WriteStartArrayMember("next"); ProtocolSerializer.SerializeProtocolStepNextComponent(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); }
public static void SerializeProtocolStepActivityComponent(Hl7.Fhir.Model.Protocol.ProtocolStepActivityComponent value, IFhirWriter writer) { writer.WriteStartComplexContent(); // Serialize element extension if (value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element _id if (value.LocalId != null) { writer.WriteStartElement("_id"); IdSerializer.SerializeId(value.LocalId, writer); writer.WriteEndElement(); } // Serialize element alternative if (value.Alternative != null && value.Alternative.Count > 0) { writer.WriteStartArrayElement("alternative"); foreach (var item in value.Alternative) { writer.WriteStartArrayMember("alternative"); IdRefSerializer.SerializeIdRef(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element component if (value.Component != null && value.Component.Count > 0) { writer.WriteStartArrayElement("component"); foreach (var item in value.Component) { writer.WriteStartArrayMember("component"); ProtocolSerializer.SerializeProtocolStepActivityComponentComponent(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element following if (value.Following != null && value.Following.Count > 0) { writer.WriteStartArrayElement("following"); foreach (var item in value.Following) { writer.WriteStartArrayMember("following"); IdRefSerializer.SerializeIdRef(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element wait if (value.Wait != null) { writer.WriteStartElement("wait"); QuantitySerializer.SerializeQuantity(value.Wait, writer); writer.WriteEndElement(); } // Serialize element detail if (value.Detail != null) { writer.WriteStartElement("detail"); ActivityDefinitionSerializer.SerializeActivityDefinition(value.Detail, writer); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeTest(Hl7.Fhir.Model.Test value, IFhirWriter writer) { writer.WriteStartRootObject("Test"); writer.WriteStartComplexContent(); // Serialize element extension if (value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element language if (value.Language != null) { writer.WriteStartElement("language"); CodeSerializer.SerializeCode(value.Language, writer); writer.WriteEndElement(); } // Serialize element text if (value.Text != null) { writer.WriteStartElement("text"); NarrativeSerializer.SerializeNarrative(value.Text, writer); writer.WriteEndElement(); } // Serialize element contained if (value.Contained != null && value.Contained.Count > 0) { writer.WriteStartArrayElement("contained"); foreach (var item in value.Contained) { writer.WriteStartArrayMember("contained"); FhirSerializer.SerializeResource(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element _id if (value.LocalId != null) { writer.WriteStartElement("_id"); IdSerializer.SerializeId(value.LocalId, writer); writer.WriteEndElement(); } // Serialize element stringErr if (value.StringErr != null && value.StringErr.Count > 0) { writer.WriteStartArrayElement("stringErr"); foreach (var item in value.StringErr) { writer.WriteStartArrayMember("stringErr"); FhirStringSerializer.SerializeFhirString(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element stringCorr if (value.StringCorr != null && value.StringCorr.Count > 0) { writer.WriteStartArrayElement("stringCorr"); foreach (var item in value.StringCorr) { writer.WriteStartArrayMember("stringCorr"); FhirStringSerializer.SerializeFhirString(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element booleanErr if (value.BooleanErr != null && value.BooleanErr.Count > 0) { writer.WriteStartArrayElement("booleanErr"); foreach (var item in value.BooleanErr) { writer.WriteStartArrayMember("booleanErr"); FhirBooleanSerializer.SerializeFhirBoolean(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element booleanCorr if (value.BooleanCorr != null && value.BooleanCorr.Count > 0) { writer.WriteStartArrayElement("booleanCorr"); foreach (var item in value.BooleanCorr) { writer.WriteStartArrayMember("booleanCorr"); FhirBooleanSerializer.SerializeFhirBoolean(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element integerErr if (value.IntegerErr != null && value.IntegerErr.Count > 0) { writer.WriteStartArrayElement("integerErr"); foreach (var item in value.IntegerErr) { writer.WriteStartArrayMember("integerErr"); IntegerSerializer.SerializeInteger(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element integerCorr if (value.IntegerCorr != null && value.IntegerCorr.Count > 0) { writer.WriteStartArrayElement("integerCorr"); foreach (var item in value.IntegerCorr) { writer.WriteStartArrayMember("integerCorr"); IntegerSerializer.SerializeInteger(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element decimalErr if (value.DecimalErr != null && value.DecimalErr.Count > 0) { writer.WriteStartArrayElement("decimalErr"); foreach (var item in value.DecimalErr) { writer.WriteStartArrayMember("decimalErr"); FhirDecimalSerializer.SerializeFhirDecimal(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element decimalCorr if (value.DecimalCorr != null && value.DecimalCorr.Count > 0) { writer.WriteStartArrayElement("decimalCorr"); foreach (var item in value.DecimalCorr) { writer.WriteStartArrayMember("decimalCorr"); FhirDecimalSerializer.SerializeFhirDecimal(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element b64Err if (value.B64Err != null && value.B64Err.Count > 0) { writer.WriteStartArrayElement("b64Err"); foreach (var item in value.B64Err) { writer.WriteStartArrayMember("b64Err"); Base64BinarySerializer.SerializeBase64Binary(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element b64Corr if (value.B64Corr != null && value.B64Corr.Count > 0) { writer.WriteStartArrayElement("b64Corr"); foreach (var item in value.B64Corr) { writer.WriteStartArrayMember("b64Corr"); Base64BinarySerializer.SerializeBase64Binary(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element instantErr if (value.InstantErr != null && value.InstantErr.Count > 0) { writer.WriteStartArrayElement("instantErr"); foreach (var item in value.InstantErr) { writer.WriteStartArrayMember("instantErr"); InstantSerializer.SerializeInstant(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element instantCorr if (value.InstantCorr != null && value.InstantCorr.Count > 0) { writer.WriteStartArrayElement("instantCorr"); foreach (var item in value.InstantCorr) { writer.WriteStartArrayMember("instantCorr"); InstantSerializer.SerializeInstant(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element uriErr if (value.UriErr != null && value.UriErr.Count > 0) { writer.WriteStartArrayElement("uriErr"); foreach (var item in value.UriErr) { writer.WriteStartArrayMember("uriErr"); FhirUriSerializer.SerializeFhirUri(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element uriCorr if (value.UriCorr != null && value.UriCorr.Count > 0) { writer.WriteStartArrayElement("uriCorr"); foreach (var item in value.UriCorr) { writer.WriteStartArrayMember("uriCorr"); FhirUriSerializer.SerializeFhirUri(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element idrefSingle if (value.IdrefSingle != null) { writer.WriteStartElement("idrefSingle"); IdRefSerializer.SerializeIdRef(value.IdrefSingle, writer); writer.WriteEndElement(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
internal static void SerializeElement(Element value, IFhirWriter writer, bool summary) { if (value.GetType() == typeof(Hl7.Fhir.Model.Address)) { AddressSerializer.SerializeAddress((Hl7.Fhir.Model.Address)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Attachment)) { AttachmentSerializer.SerializeAttachment((Hl7.Fhir.Model.Attachment)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Choice)) { ChoiceSerializer.SerializeChoice((Hl7.Fhir.Model.Choice)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.CodeableConcept)) { CodeableConceptSerializer.SerializeCodeableConcept((Hl7.Fhir.Model.CodeableConcept)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Coding)) { CodingSerializer.SerializeCoding((Hl7.Fhir.Model.Coding)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Contact)) { ContactSerializer.SerializeContact((Hl7.Fhir.Model.Contact)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Extension)) { ExtensionSerializer.SerializeExtension((Hl7.Fhir.Model.Extension)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.HumanName)) { HumanNameSerializer.SerializeHumanName((Hl7.Fhir.Model.HumanName)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Identifier)) { IdentifierSerializer.SerializeIdentifier((Hl7.Fhir.Model.Identifier)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Narrative)) { NarrativeSerializer.SerializeNarrative((Hl7.Fhir.Model.Narrative)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Period)) { PeriodSerializer.SerializePeriod((Hl7.Fhir.Model.Period)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Quantity)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Quantity)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Range)) { RangeSerializer.SerializeRange((Hl7.Fhir.Model.Range)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Ratio)) { RatioSerializer.SerializeRatio((Hl7.Fhir.Model.Ratio)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.ResourceReference)) { ResourceReferenceSerializer.SerializeResourceReference((Hl7.Fhir.Model.ResourceReference)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.SampledData)) { SampledDataSerializer.SerializeSampledData((Hl7.Fhir.Model.SampledData)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Schedule)) { ScheduleSerializer.SerializeSchedule((Hl7.Fhir.Model.Schedule)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Base64Binary)) { Base64BinarySerializer.SerializeBase64Binary((Hl7.Fhir.Model.Base64Binary)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirBoolean)) { FhirBooleanSerializer.SerializeFhirBoolean((Hl7.Fhir.Model.FhirBoolean)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Code)) { CodeSerializer.SerializeCode((Hl7.Fhir.Model.Code)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Date)) { DateSerializer.SerializeDate((Hl7.Fhir.Model.Date)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirDateTime)) { FhirDateTimeSerializer.SerializeFhirDateTime((Hl7.Fhir.Model.FhirDateTime)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirDecimal)) { FhirDecimalSerializer.SerializeFhirDecimal((Hl7.Fhir.Model.FhirDecimal)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Id)) { IdSerializer.SerializeId((Hl7.Fhir.Model.Id)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.IdRef)) { IdRefSerializer.SerializeIdRef((Hl7.Fhir.Model.IdRef)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Instant)) { InstantSerializer.SerializeInstant((Hl7.Fhir.Model.Instant)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Integer)) { IntegerSerializer.SerializeInteger((Hl7.Fhir.Model.Integer)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Oid)) { OidSerializer.SerializeOid((Hl7.Fhir.Model.Oid)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirString)) { FhirStringSerializer.SerializeFhirString((Hl7.Fhir.Model.FhirString)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirUri)) { FhirUriSerializer.SerializeFhirUri((Hl7.Fhir.Model.FhirUri)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Uuid)) { UuidSerializer.SerializeUuid((Hl7.Fhir.Model.Uuid)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.XHtml)) { XHtmlSerializer.SerializeXHtml((Hl7.Fhir.Model.XHtml)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Age)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Age)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Count)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Count)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Distance)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Distance)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Duration)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Duration)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Money)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Money)value, writer, summary); } else { throw new Exception("Encountered unknown type " + value.GetType().Name); } }