Exemple #1
0
 public void Stop()
 {
     if (_recordedElement != null)
     {
         _recordedElement.Release();
         _recordedElement = null;
     }
 }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Provenance;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Target != null)
                {
                    dest.Target = new List <Hl7.Fhir.Model.ResourceReference>(Target.DeepCopy());
                }
                if (Period != null)
                {
                    dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy();
                }
                if (RecordedElement != null)
                {
                    dest.RecordedElement = (Hl7.Fhir.Model.Instant)RecordedElement.DeepCopy();
                }
                if (Reason != null)
                {
                    dest.Reason = new List <Hl7.Fhir.Model.CodeableConcept>(Reason.DeepCopy());
                }
                if (Activity != null)
                {
                    dest.Activity = (Hl7.Fhir.Model.CodeableConcept)Activity.DeepCopy();
                }
                if (Location != null)
                {
                    dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopy();
                }
                if (PolicyElement != null)
                {
                    dest.PolicyElement = new List <Hl7.Fhir.Model.FhirUri>(PolicyElement.DeepCopy());
                }
                if (Agent != null)
                {
                    dest.Agent = new List <Hl7.Fhir.Model.Provenance.AgentComponent>(Agent.DeepCopy());
                }
                if (Entity != null)
                {
                    dest.Entity = new List <Hl7.Fhir.Model.Provenance.EntityComponent>(Entity.DeepCopy());
                }
                if (Signature != null)
                {
                    dest.Signature = new List <Hl7.Fhir.Model.Signature>(Signature.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Exemple #3
0
        public void Record(IUndoRedoService undoRedoService, object objToRecord)
        {
            if (undoRedoService == null)
            {
                throw new ArgumentNullException("undoRedoService");
            }
            if (objToRecord == null)
            {
                throw new ArgumentNullException("objToRecord");
            }

            this.UndoRedoService = undoRedoService;

            _recordedElement = RecordedElementFactory.Create(undoRedoService, objToRecord);
        }
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (Target != null)
            {
                Target.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Period != null)
            {
                result.AddRange(Period.Validate());
            }
            if (RecordedElement != null)
            {
                result.AddRange(RecordedElement.Validate());
            }
            if (Reason != null)
            {
                result.AddRange(Reason.Validate());
            }
            if (Location != null)
            {
                result.AddRange(Location.Validate());
            }
            if (PolicyElement != null)
            {
                PolicyElement.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Agent != null)
            {
                Agent.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Entity != null)
            {
                Entity.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (SignatureElement != null)
            {
                result.AddRange(SignatureElement.Validate());
            }

            return(result);
        }