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 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 SerializeProtocol(Hl7.Fhir.Model.Protocol value, IFhirWriter writer) { writer.WriteStartRootObject("Protocol"); 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 title if (value.Title != null) { writer.WriteStartElement("title"); FhirStringSerializer.SerializeFhirString(value.Title, writer); writer.WriteEndElement(); } // Serialize element type if (value.Type != null) { writer.WriteStartElement("type"); CodeSerializer.SerializeCode <Hl7.Fhir.Model.Protocol.ProtocolType>(value.Type, writer); writer.WriteEndElement(); } // Serialize element status if (value.Status != null) { writer.WriteStartElement("status"); CodeSerializer.SerializeCode <Hl7.Fhir.Model.Protocol.ProtocolStatus>(value.Status, writer); writer.WriteEndElement(); } // Serialize element author if (value.Author != null) { writer.WriteStartElement("author"); ResourceReferenceSerializer.SerializeResourceReference(value.Author, writer); writer.WriteEndElement(); } // Serialize element purpose if (value.Purpose != null) { writer.WriteStartElement("purpose"); FhirStringSerializer.SerializeFhirString(value.Purpose, writer); writer.WriteEndElement(); } // Serialize element subject if (value.Subject != null) { writer.WriteStartElement("subject"); ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer); writer.WriteEndElement(); } // Serialize element group if (value.Group != null) { writer.WriteStartElement("group"); ResourceReferenceSerializer.SerializeResourceReference(value.Group, writer); writer.WriteEndElement(); } // Serialize element step if (value.Step != null && value.Step.Count > 0) { writer.WriteStartArrayElement("step"); foreach (var item in value.Step) { writer.WriteStartArrayMember("step"); ProtocolSerializer.SerializeProtocolStepComponent(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
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(); }