Example #1
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }

            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((Fhir.R4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if ((Identifier != null) && (Identifier.Count != 0))
            {
                writer.WritePropertyName("identifier");
                writer.WriteStartArray();

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Type != null)
            {
                writer.WritePropertyName("type");
                Type.SerializeJson(writer, options);
            }

            writer.WriteBoolean("orderable", Orderable);

            if (ReferencedItem != null)
            {
                writer.WritePropertyName("referencedItem");
                ReferencedItem.SerializeJson(writer, options);
            }

            if ((AdditionalIdentifier != null) && (AdditionalIdentifier.Count != 0))
            {
                writer.WritePropertyName("additionalIdentifier");
                writer.WriteStartArray();

                foreach (Identifier valAdditionalIdentifier in AdditionalIdentifier)
                {
                    valAdditionalIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Classification != null) && (Classification.Count != 0))
            {
                writer.WritePropertyName("classification");
                writer.WriteStartArray();

                foreach (CodeableConcept valClassification in Classification)
                {
                    valClassification.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

            if (_Status != null)
            {
                writer.WritePropertyName("_status");
                _Status.SerializeJson(writer, options);
            }

            if (ValidityPeriod != null)
            {
                writer.WritePropertyName("validityPeriod");
                ValidityPeriod.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValidTo))
            {
                writer.WriteString("validTo", (string)ValidTo !);
            }

            if (_ValidTo != null)
            {
                writer.WritePropertyName("_validTo");
                _ValidTo.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(LastUpdated))
            {
                writer.WriteString("lastUpdated", (string)LastUpdated !);
            }

            if (_LastUpdated != null)
            {
                writer.WritePropertyName("_lastUpdated");
                _LastUpdated.SerializeJson(writer, options);
            }

            if ((AdditionalCharacteristic != null) && (AdditionalCharacteristic.Count != 0))
            {
                writer.WritePropertyName("additionalCharacteristic");
                writer.WriteStartArray();

                foreach (CodeableConcept valAdditionalCharacteristic in AdditionalCharacteristic)
                {
                    valAdditionalCharacteristic.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((AdditionalClassification != null) && (AdditionalClassification.Count != 0))
            {
                writer.WritePropertyName("additionalClassification");
                writer.WriteStartArray();

                foreach (CodeableConcept valAdditionalClassification in AdditionalClassification)
                {
                    valAdditionalClassification.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((RelatedEntry != null) && (RelatedEntry.Count != 0))
            {
                writer.WritePropertyName("relatedEntry");
                writer.WriteStartArray();

                foreach (CatalogEntryRelatedEntry valRelatedEntry in RelatedEntry)
                {
                    valRelatedEntry.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Example #2
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as CatalogEntry;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (Type != null)
            {
                dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy();
            }
            if (OrderableElement != null)
            {
                dest.OrderableElement = (Hl7.Fhir.Model.FhirBoolean)OrderableElement.DeepCopy();
            }
            if (ReferencedItem != null)
            {
                dest.ReferencedItem = (Hl7.Fhir.Model.ResourceReference)ReferencedItem.DeepCopy();
            }
            if (AdditionalIdentifier != null)
            {
                dest.AdditionalIdentifier = new List <Hl7.Fhir.Model.Identifier>(AdditionalIdentifier.DeepCopy());
            }
            if (Classification != null)
            {
                dest.Classification = new List <Hl7.Fhir.Model.CodeableConcept>(Classification.DeepCopy());
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.PublicationStatus>)StatusElement.DeepCopy();
            }
            if (ValidityPeriod != null)
            {
                dest.ValidityPeriod = (Hl7.Fhir.Model.Period)ValidityPeriod.DeepCopy();
            }
            if (ValidToElement != null)
            {
                dest.ValidToElement = (Hl7.Fhir.Model.FhirDateTime)ValidToElement.DeepCopy();
            }
            if (LastUpdatedElement != null)
            {
                dest.LastUpdatedElement = (Hl7.Fhir.Model.FhirDateTime)LastUpdatedElement.DeepCopy();
            }
            if (AdditionalCharacteristic != null)
            {
                dest.AdditionalCharacteristic = new List <Hl7.Fhir.Model.CodeableConcept>(AdditionalCharacteristic.DeepCopy());
            }
            if (AdditionalClassification != null)
            {
                dest.AdditionalClassification = new List <Hl7.Fhir.Model.CodeableConcept>(AdditionalClassification.DeepCopy());
            }
            if (RelatedEntry != null)
            {
                dest.RelatedEntry = new List <Hl7.Fhir.Model.CatalogEntry.RelatedEntryComponent>(RelatedEntry.DeepCopy());
            }
            return(dest);
        }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as CatalogEntry;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (NameElement != null)
            {
                dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
            }
            if (TypeElement != null)
            {
                dest.TypeElement = (Code <Hl7.Fhir.Model.CatalogEntry.CatalogEntryType>)TypeElement.DeepCopy();
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.CatalogEntry.CatalogEntryStatus>)StatusElement.DeepCopy();
            }
            if (EffectivePeriod != null)
            {
                dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopy();
            }
            if (OrderableElement != null)
            {
                dest.OrderableElement = (Hl7.Fhir.Model.FhirBoolean)OrderableElement.DeepCopy();
            }
            if (ReferencedItem != null)
            {
                dest.ReferencedItem = (Hl7.Fhir.Model.ResourceReference)ReferencedItem.DeepCopy();
            }
            if (RelatedEntry != null)
            {
                dest.RelatedEntry = new List <Hl7.Fhir.Model.CatalogEntry.RelatedEntryComponent>(RelatedEntry.DeepCopy());
            }
            if (UpdatedBy != null)
            {
                dest.UpdatedBy = (Hl7.Fhir.Model.ResourceReference)UpdatedBy.DeepCopy();
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            if (EstimatedDuration != null)
            {
                dest.EstimatedDuration = (Hl7.Fhir.Model.Duration)EstimatedDuration.DeepCopy();
            }
            if (BillingCode != null)
            {
                dest.BillingCode = new List <Hl7.Fhir.Model.CodeableConcept>(BillingCode.DeepCopy());
            }
            if (BillingSummaryElement != null)
            {
                dest.BillingSummaryElement = (Hl7.Fhir.Model.FhirString)BillingSummaryElement.DeepCopy();
            }
            if (ScheduleSummaryElement != null)
            {
                dest.ScheduleSummaryElement = (Hl7.Fhir.Model.FhirString)ScheduleSummaryElement.DeepCopy();
            }
            if (LimitationSummaryElement != null)
            {
                dest.LimitationSummaryElement = (Hl7.Fhir.Model.FhirString)LimitationSummaryElement.DeepCopy();
            }
            if (RegulatorySummaryElement != null)
            {
                dest.RegulatorySummaryElement = (Hl7.Fhir.Model.FhirString)RegulatorySummaryElement.DeepCopy();
            }
            return(dest);
        }