Example #1
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as CarePlan;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (Patient != null)
                {
                    dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.CarePlan.CarePlanStatus>)StatusElement.DeepCopy();
                }
                if (Period != null)
                {
                    dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy();
                }
                if (ModifiedElement != null)
                {
                    dest.ModifiedElement = (Hl7.Fhir.Model.FhirDateTime)ModifiedElement.DeepCopy();
                }
                if (Concern != null)
                {
                    dest.Concern = new List <Hl7.Fhir.Model.ResourceReference>(Concern.DeepCopy());
                }
                if (Participant != null)
                {
                    dest.Participant = new List <Hl7.Fhir.Model.CarePlan.CarePlanParticipantComponent>(Participant.DeepCopy());
                }
                if (Goal != null)
                {
                    dest.Goal = new List <Hl7.Fhir.Model.CarePlan.CarePlanGoalComponent>(Goal.DeepCopy());
                }
                if (Activity != null)
                {
                    dest.Activity = new List <Hl7.Fhir.Model.CarePlan.CarePlanActivityComponent>(Activity.DeepCopy());
                }
                if (NotesElement != null)
                {
                    dest.NotesElement = (Hl7.Fhir.Model.FhirString)NotesElement.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Example #2
0
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (Identifier != null)
            {
                result.AddRange(Identifier.Validate());
            }
            if (Patient != null)
            {
                result.AddRange(Patient.Validate());
            }
            if (StatusElement != null)
            {
                result.AddRange(StatusElement.Validate());
            }
            if (Period != null)
            {
                result.AddRange(Period.Validate());
            }
            if (ModifiedElement != null)
            {
                result.AddRange(ModifiedElement.Validate());
            }
            if (Concern != null)
            {
                Concern.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Participant != null)
            {
                Participant.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Goal != null)
            {
                Goal.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Activity != null)
            {
                Activity.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (NotesElement != null)
            {
                result.AddRange(NotesElement.Validate());
            }

            return(result);
        }