Exemple #1
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            DesignByContract.Check.Assert(reader.LocalName == "instruction_id",
                                          "Expected LocalName is 'instruction_id', but it is " + reader.LocalName);
            this.instructionId = new OpenEhr.RM.Support.Identification.LocatableRef();
            this.instructionId.ReadXml(reader);

            DesignByContract.Check.Assert(reader.LocalName == "activity_id",
                                          "Expected LocalName is 'activity_id', but it is " + reader.LocalName);
            this.activityId = reader.ReadElementString("activity_id", RmXmlSerializer.OpenEhrNamespace);

            if (reader.LocalName == "wf_details")
            {
                string wfDetailsType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                this.wfDetails = OpenEhr.RM.Common.Archetyped.Impl.Locatable.GetLocatableObjectByType(wfDetailsType)
                                 as OpenEhr.RM.DataStructures.ItemStructure.ItemStructure;
                if (this.wfDetails == null)
                {
                    throw new InvalidOperationException("wfDetailsType must by type of ItemStructure: " + wfDetails);
                }
                this.wfDetails.ReadXml(reader);
                this.wfDetails.Parent = this;
            }

            DesignByContract.Check.Assert(reader.NodeType == System.Xml.XmlNodeType.EndElement, "Expected endElement of InstructionDetails.");
            reader.ReadEndElement();
            reader.MoveToContent();

            // CM: 26/11/09 need to set attributDictionary since InstructionDetails is not type of locatable
            this.SetAttributeDictionary();
            this.CheckInvariants();
        }
        public InstructionDetails(LocatableRef instructionId,
            string activityId, ItemStructure wfDetails)
            : this()
        {
            Check.Require(instructionId != null, "instruction_id must not be null");
            Check.Require(!string.IsNullOrEmpty(activityId), "activity_id must not be null or empty");

            this.instructionId = instructionId;
            this.activityId = activityId;
            this.wfDetails = wfDetails;
            if (this.wfDetails != null)
                this.wfDetails.Parent = this;

            SetAttributeDictionary();
        }
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            DesignByContract.Check.Assert(reader.LocalName == "instruction_id",
                "Expected LocalName is 'instruction_id', but it is " + reader.LocalName);
            this.instructionId = new OpenEhr.RM.Support.Identification.LocatableRef();
            this.instructionId.ReadXml(reader);

            DesignByContract.Check.Assert(reader.LocalName == "activity_id",
                "Expected LocalName is 'activity_id', but it is " + reader.LocalName);
            this.activityId = reader.ReadElementString("activity_id", RmXmlSerializer.OpenEhrNamespace);

            if (reader.LocalName == "wf_details")
            {
                string wfDetailsType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                this.wfDetails = OpenEhr.RM.Common.Archetyped.Impl.Locatable.GetLocatableObjectByType(wfDetailsType)
                    as OpenEhr.RM.DataStructures.ItemStructure.ItemStructure;
                if (this.wfDetails == null)
                    throw new InvalidOperationException("wfDetailsType must by type of ItemStructure: " + wfDetails);
                this.wfDetails.ReadXml(reader);
                this.wfDetails.Parent = this;
            }

            DesignByContract.Check.Assert(reader.NodeType == System.Xml.XmlNodeType.EndElement, "Expected endElement of InstructionDetails.");
            reader.ReadEndElement();
            reader.MoveToContent();

            // CM: 26/11/09 need to set attributDictionary since InstructionDetails is not type of locatable
            this.SetAttributeDictionary();
            this.CheckInvariants();
        }