public static void SerializeSecurityEventObjectDetailComponent(Hl7.Fhir.Model.SecurityEvent.SecurityEventObjectDetailComponent 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 type
            if (value.TypeElement != null)
            {
                writer.WriteStartElement("type");
                FhirStringSerializer.SerializeFhirString(value.TypeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element value
            if (value.ValueElement != null)
            {
                writer.WriteStartElement("value");
                Base64BinarySerializer.SerializeBase64Binary(value.ValueElement, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
        }
        public static void SerializeConformanceRestSecurityCertificateComponent(Hl7.Fhir.Model.Conformance.ConformanceRestSecurityCertificateComponent 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 type
            if (value.TypeElement != null)
            {
                writer.WriteStartElement("type");
                CodeSerializer.SerializeCode(value.TypeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element blob
            if (value.BlobElement != null)
            {
                writer.WriteStartElement("blob");
                Base64BinarySerializer.SerializeBase64Binary(value.BlobElement, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
        }
예제 #3
0
        public static void SerializeAttachment(Hl7.Fhir.Model.Attachment 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 contentType
            if (value.ContentTypeElement != null)
            {
                writer.WriteStartElement("contentType");
                CodeSerializer.SerializeCode(value.ContentTypeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element language
            if (value.LanguageElement != null)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.LanguageElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element data
            if (value.DataElement != null)
            {
                writer.WriteStartElement("data");
                Base64BinarySerializer.SerializeBase64Binary(value.DataElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element url
            if (value.UrlElement != null)
            {
                writer.WriteStartElement("url");
                FhirUriSerializer.SerializeFhirUri(value.UrlElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element size
            if (value.SizeElement != null)
            {
                writer.WriteStartElement("size");
                IntegerSerializer.SerializeInteger(value.SizeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element hash
            if (value.HashElement != null)
            {
                writer.WriteStartElement("hash");
                Base64BinarySerializer.SerializeBase64Binary(value.HashElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element title
            if (value.TitleElement != null)
            {
                writer.WriteStartElement("title");
                FhirStringSerializer.SerializeFhirString(value.TitleElement, writer, summary);
                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();
        }
        public static void SerializeSecurityEventObjectComponent(Hl7.Fhir.Model.SecurityEvent.SecurityEventObjectComponent 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 identifier
            if (value.Identifier != null)
            {
                writer.WriteStartElement("identifier");
                IdentifierSerializer.SerializeIdentifier(value.Identifier, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element reference
            if (value.Reference != null)
            {
                writer.WriteStartElement("reference");
                ResourceReferenceSerializer.SerializeResourceReference(value.Reference, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element type
            if (value.TypeElement != null)
            {
                writer.WriteStartElement("type");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.SecurityEvent.SecurityEventObjectType>(value.TypeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element role
            if (value.RoleElement != null)
            {
                writer.WriteStartElement("role");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.SecurityEvent.SecurityEventObjectRole>(value.RoleElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element lifecycle
            if (value.LifecycleElement != null)
            {
                writer.WriteStartElement("lifecycle");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.SecurityEvent.SecurityEventObjectLifecycle>(value.LifecycleElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element sensitivity
            if (value.Sensitivity != null)
            {
                writer.WriteStartElement("sensitivity");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Sensitivity, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element name
            if (value.NameElement != null)
            {
                writer.WriteStartElement("name");
                FhirStringSerializer.SerializeFhirString(value.NameElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element query
            if (value.QueryElement != null)
            {
                writer.WriteStartElement("query");
                Base64BinarySerializer.SerializeBase64Binary(value.QueryElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element detail
            if (value.Detail != null && value.Detail.Count > 0)
            {
                writer.WriteStartArrayElement("detail");
                foreach (var item in value.Detail)
                {
                    writer.WriteStartArrayMember("detail");
                    SecurityEventSerializer.SerializeSecurityEventObjectDetailComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
        }
 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);
     }
 }