Beispiel #1
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.LocalName == "items")
            {
                LocatableList <Element> items = new LocatableList <Element>();

                do
                {
                    Element element = new Element();
                    element.ReadXml(reader);
                    element.Parent = this;
                    items.Add(element);
                    // Added checking on reader.NodeType == Element is because ItemList xml instance
                    // is something like: <items> <items xsi:type='ELEMENT'>..</items></items>.
                    // After reading all element contents, the reader.LocalName is still items,
                    // but the reader NodeType is EndElement. This situation is similar as Section, ItemTable
                } while (reader.LocalName == "items" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.items = items;
            }

            reader.MoveToContent();
        }
Beispiel #2
0
 protected CAttribute(string rmAttributeName, AssumedTypes.Interval <int> existence,
                      AssumedTypes.List <CObject> children)
 {
     this.RmAttributeName = rmAttributeName;
     this.Existence       = existence;
     this.Children        = children;
 }
Beispiel #3
0
        protected override void ReadXmlBase(XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.LocalName == "items")
            {
                OpenEhr.AssumedTypes.Impl.LocatableList <Item> items =
                    new OpenEhr.AssumedTypes.Impl.LocatableList <Item>();
                while (reader.LocalName == "items" && reader.NodeType == System.Xml.XmlNodeType.Element)
                {
                    string itemType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);

                    Item anItem = Item.GetLocatableObjectByType(itemType) as Item;
                    if (anItem == null)
                    {
                        throw new InvalidOperationException("itemType must be type of Item: " + itemType);
                    }
                    anItem.ReadXml(reader);
                    anItem.Parent = this;
                    items.Add(anItem);
                }

                this.items = items;
            }
        }
Beispiel #4
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.NodeType == System.Xml.XmlNodeType.Element && reader.LocalName == "folders")
            {
                LocatableList <Folder> folders = new LocatableList <Folder>();
                do
                {
                    Folder folder = new Folder();

                    folder.ReadXml(reader);

                    folder.Parent = this;
                    folders.Add(folder);
                } while (reader.LocalName == "folders" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.folders = folders;
            }

            if (reader.LocalName == "items")
            {
                AssumedTypes.List <ObjectRef> items = new AssumedTypes.List <ObjectRef>();
                do
                {
                    ObjectRef item = new ObjectRef();

                    item.ReadXml(reader);
                    items.Add(item);
                } while (reader.LocalName == "items" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.items = items;
            }
        }
Beispiel #5
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            Check.Assert(reader.LocalName == "language", "Expected LocalName is 'language' rather than " +
                         reader.LocalName);
            this.language = new OpenEhr.RM.DataTypes.Text.CodePhrase();
            this.language.ReadXml(reader);

            Check.Assert(reader.LocalName == "encoding", "Expected LocalName is 'encoding' rather than " +
                         reader.LocalName);
            this.encoding = new OpenEhr.RM.DataTypes.Text.CodePhrase();
            this.encoding.ReadXml(reader);

            Check.Assert(reader.LocalName == "subject", "Expected LocalName is 'subject' rather than " +
                         reader.LocalName);
            string subjectType = RmXmlSerializer.ReadXsiType(reader);

            this.subject = RmFactory.PartyProxy(subjectType);

            this.subject.ReadXml(reader);


            if (reader.LocalName == "provider")
            {
                string providerType = RmXmlSerializer.ReadXsiType(reader);
                this.provider = RmFactory.PartyProxy(providerType);

                this.provider.ReadXml(reader);
            }

            if (reader.LocalName == "other_participations")
            {
                this.otherParticipations = new OpenEhr.AssumedTypes.List <Participation>();
                do
                {
                    Participation p = new Participation();
                    p.ReadXml(reader);

                    this.otherParticipations.Add(p);
                } while (reader.LocalName == "other_participations");
            }

            if (reader.LocalName == "work_flow_id")
            {
                string workFlowIdType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);

                // CM: 06/09/10 when workFlowIdType is null or empty, it's type of OBJECT_REF
                if (string.IsNullOrEmpty(workFlowIdType))
                {
                    this.workflowId = new ObjectRef();
                }
                else
                {
                    this.workflowId = ObjectRef.GetObjectRefByType(workFlowIdType);
                }

                this.workflowId.ReadXml(reader);
            }
        }
Beispiel #6
0
        public object ItemAtPath(object obj)
        {
            object itemAtPath = this.pathExpr.Evaluate(obj);

            AssumedTypes.IList iList = itemAtPath as AssumedTypes.IList;

            // if itemAtPath is not a list, return it.
            if (iList == null)
            {
                return(itemAtPath);
            }

            //// if itemAtPath is a list, generate LocatableList when the items are locatable.
            //// otherwise return the list
            LocatableList <Locatable> locatableList = null;


            AssumedTypes.List <object> items = iList as AssumedTypes.List <object>;
            if (items != null)
            {
                return(items);
            }
            else
            {
                items = new OpenEhr.AssumedTypes.List <object>();
            }

            foreach (object o in iList)
            {
                items.Add(o);
            }

            return(items);
        }
Beispiel #7
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="items">The items in this history in most-recent-last order.</param>
 public RevisionHistory(AssumedTypes.List<RevisionHistoryItem> items)
 {
     DesignByContract.Check.Require(items!= null, "items must not be null.");
     // %HYYKA%
     // TODO: need to sort the order according to the spec
     //this.items = SortItemsInMostRecentLastOrder(items);
     this.items = items;
 }
        public RevisionHistoryItem(AssumedTypes.List<AuditDetails> audits,
            OpenEhr.RM.Support.Identification.ObjectVersionId versionId)
        {
            Check.Require(versionId != null, "version_id must not be null");

            this.audits = audits;
            this.versionId = versionId;
        }
Beispiel #9
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="items">The items in this history in most-recent-last order.</param>
 public RevisionHistory(AssumedTypes.List <RevisionHistoryItem> items)
 {
     DesignByContract.Check.Require(items != null, "items must not be null.");
     // %HYYKA%
     // TODO: need to sort the order according to the spec
     //this.items = SortItemsInMostRecentLastOrder(items);
     this.items = items;
 }
        public RevisionHistoryItem(AssumedTypes.List <AuditDetails> audits,
                                   OpenEhr.RM.Support.Identification.ObjectVersionId versionId)
        {
            Check.Require(versionId != null, "version_id must not be null");

            this.audits    = audits;
            this.versionId = versionId;
        }
Beispiel #11
0
 public FeederAudit(FeederAuditDetails originatingSystemAudit,
                    AssumedTypes.List <DataTypes.Basic.DvIdentifier> originatingSystemItemIds,
                    DataTypes.Encapsulated.DvEncapsulated originalContent)
     : this()
 {
     Check.Require(originatingSystemAudit != null);
     this.originatingSystemAudit   = originatingSystemAudit;
     this.originatingSystemItemIds = originatingSystemItemIds;
     this.originalContent          = originalContent;
 }
Beispiel #12
0
 public FeederAudit(FeederAuditDetails originatingSystemAudit,
     AssumedTypes.List<DataTypes.Basic.DvIdentifier> originatingSystemItemIds,            
     DataTypes.Encapsulated.DvEncapsulated originalContent)
     : this()
 {
     Check.Require(originatingSystemAudit != null);
     this.originatingSystemAudit = originatingSystemAudit;
     this.originatingSystemItemIds = originatingSystemItemIds;
     this.originalContent = originalContent;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="originalAuthor">Original author of this resource, with all relevant details, including organisation.</param>
 /// <param name="lifecycleState">Lifecycle state of the resource, typically including states such as: initial, submitted, experimental,
 /// awaiting_approval, approved, superseded, obsolete.</param>
 /// <param name="details">Details of all parts of resource description that are natural language-dependent, keyed by language code.</param>
 /// <param name="resourcePackageUri">URI of package to which this resource belongs.</param>
 /// <param name="otherContributors">Other contributors to the resource, probably listed in “name <email>” form.</param>
 /// <param name="otherDetails">Additional non language-senstive resource meta-data, as a list of name/value pairs.</param>
 /// <param name="parentResource">Reference to owning resource.</param>
 public ResourceDescription(AssumedTypes.Hash <string, string> originalAuthor, string lifecycleState,
                            AssumedTypes.Hash <ResourceDescriptionItem, string> details, string resourcePackageUri,
                            AssumedTypes.List <string> otherContributors, AssumedTypes.Hash <string, string> otherDetails,
                            AuthoredResource parentResource) : this(originalAuthor, lifecycleState, details)
 {
     this.resourcePackageUri = resourcePackageUri;
     this.otherContributors  = otherContributors;
     this.otherDetails       = otherDetails;
     this.parentResource     = parentResource;
 }
Beispiel #14
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            // read for the attributes in this local class
            Check.Assert(reader.LocalName == "uid", "Expected LocalName as uid rather than " + reader.LocalName);
            this.uid = new OpenEhr.RM.Support.Identification.ObjectVersionId();
            this.uid.ReadXml(reader);

            if (reader.LocalName == "data")
            {
                string dataType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);

                OpenEhr.RM.Common.Archetyped.Impl.Locatable locatableData =
                    OpenEhr.RM.Common.Archetyped.Impl.Locatable.GetLocatableObjectByType(dataType);
                locatableData.ReadXml(reader);
                this.data = locatableData as T;
            }

            if (reader.LocalName == "preceding_version_uid")
            {
                this.precedingVersionUid = new OpenEhr.RM.Support.Identification.ObjectVersionId();
                this.precedingVersionUid.ReadXml(reader);
            }

            if (reader.LocalName == "other_input_version_uids")
            {
                this.otherInputVersionUids = new AssumedTypes.Set <ObjectVersionId>();
                do
                {
                    ObjectVersionId objectVersionId = new ObjectVersionId();
                    objectVersionId.ReadXml(reader);

                    this.otherInputVersionUids.Add(objectVersionId);
                } while (reader.LocalName == "other_input_version_uids");
            }

            if (reader.LocalName == "attestations")
            {
                this.attestations = new OpenEhr.AssumedTypes.List <OpenEhr.RM.Common.Generic.Attestation>();
                do
                {
                    Generic.Attestation a = new OpenEhr.RM.Common.Generic.Attestation();
                    a.ReadXml(reader);

                    this.attestations.Add(a);
                } while (reader.LocalName == "attestations");
            }

            Check.Assert(reader.LocalName == "lifecycle_state",
                         "Expected LocalName is lifecycle_state not " + reader.LocalName);
            this.lifecycleState = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            this.lifecycleState.ReadXml(reader);
        }
Beispiel #15
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="originalAuthor">Original author of this resource, with all relevant details, including organisation.</param>
 /// <param name="lifecycleState">Lifecycle state of the resource, typically including states such as: initial, submitted, experimental,
 /// awaiting_approval, approved, superseded, obsolete.</param>
 /// <param name="details">Details of all parts of resource description that are natural language-dependent, keyed by language code.</param>
 /// <param name="resourcePackageUri">URI of package to which this resource belongs.</param>
 /// <param name="otherContributors">Other contributors to the resource, probably listed in “name <email>” form.</param>
 /// <param name="otherDetails">Additional non language-senstive resource meta-data, as a list of name/value pairs.</param>
 /// <param name="parentResource">Reference to owning resource.</param>
 public ResourceDescription(AssumedTypes.Hash<string, string> originalAuthor, string lifecycleState,
     AssumedTypes.Hash<ResourceDescriptionItem, string> details, string resourcePackageUri, 
     AssumedTypes.List<string> otherContributors, AssumedTypes.Hash<string, string> otherDetails, 
     AuthoredResource parentResource)
     : this(originalAuthor, lifecycleState, details)
 {
     this.resourcePackageUri = resourcePackageUri;
     this.otherContributors = otherContributors;
     this.otherDetails = otherDetails;
     this.parentResource = parentResource;
 }
Beispiel #16
0
        public Cluster(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid,
            Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit, Item[] items)
            : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit)
        {
            if (items != null)
            {
                this.items = RmFactory.LocatableList<Item>(this, items);
            }

            SetAttributeDictionary();
            CheckInvariants();
        }
Beispiel #17
0
        internal AssertionContext Evaluate(AssertionContext contextObj)
        {
            if (contextObj == null)
                return null;

            AssumedTypes.IList assumedIList = contextObj.Data as AssumedTypes.IList;
            if (assumedIList != null)
            {
                AssumedTypes.List<object> results = new OpenEhr.AssumedTypes.List<object>();
                foreach (object obj in assumedIList)
                {
                    AssertionContext assertObj = new AssertionContext(obj, contextObj);
                    AssertionContext evaluateResult = Evaluate(assertObj);
                    if (evaluateResult != null)
                    {
                        AssumedTypes.List<object> aList = evaluateResult.Data as AssumedTypes.List<object>;
                        if (aList == null)
                            results.Add(evaluateResult.Data);
                        else
                            foreach (object o in aList)
                                results.Add(o);
                    }
                }

                if (results.Count == 0)
                    return null;

                return new AssertionContext(results, contextObj);
            }

            System.Collections.IList list = contextObj.Data as System.Collections.IList;
            if (list == null)
            {
                return EvaluateSingleAttri(contextObj);
            }
            else
            {
                AssumedTypes.List<object> results = new AssumedTypes.List<object>();
                foreach (object obj in list)
                {
                    AssertionContext assertObj = new AssertionContext(obj, contextObj);
                    AssertionContext evaluateResult = Evaluate(assertObj);
                    if (evaluateResult != null)
                        results.Add(evaluateResult.Data);
                }

                if (results.Count == 0)
                    return null;

                return new AssertionContext(results, contextObj);
            }
        }
Beispiel #18
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.LocalName == "attested_view")
            {
                this.attestedView = new OpenEhr.RM.DataTypes.Encapsulated.DvMultimedia();
                this.attestedView.ReadXml(reader);
            }

            if (reader.LocalName == "proof")
            {
                this.proof = reader.ReadElementString("proof", RmXmlSerializer.OpenEhrNamespace);
                reader.MoveToContent();
            }

            if (reader.LocalName == "items")
            {
                this.items = new OpenEhr.AssumedTypes.List <OpenEhr.RM.DataTypes.Uri.DvEhrUri>();
                do
                {
                    DataTypes.Uri.DvEhrUri uri = new OpenEhr.RM.DataTypes.Uri.DvEhrUri();
                    uri.ReadXml(reader);

                    this.items.Add(uri);
                } while (reader.LocalName == "items");
            }

            if (reader.LocalName != "reason")
            {
                throw new ValidationException("Excepted element name is reason, but it is: " + reader.LocalName);
            }
            string reasonType = RmXmlSerializer.ReadXsiType(reader);

            if (!string.IsNullOrEmpty(reasonType))
            {
                this.reason = RmFactory.DataValue(reasonType) as DataTypes.Text.DvText;
            }
            else
            {
                this.reason = new OpenEhr.RM.DataTypes.Text.DvText();
            }
            this.reason.ReadXml(reader);

            if (reader.LocalName != "is_pending")
            {
                throw new ValidationException("Excepted element name is is_pending, but it is: " + reader.LocalName);
            }
            this.isPending = reader.ReadElementContentAsBoolean("is_pending", RmXmlSerializer.OpenEhrNamespace);
            reader.MoveToContent();
        }
Beispiel #19
0
        protected Locatable(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid,
            AssumedTypes.List<Link> links, Archetyped archetypeDetails, FeederAudit feederAudit)
            : this()
        {
            Check.Require(name != null, "name must not be null");
            Check.Require(!string.IsNullOrEmpty(archetypeNodeId), "archetype_node_id must not be null or empty");

            this.name = name;
            this.archetypeNodeId = archetypeNodeId;
            this.uid = uid;
            this.links = links;
            this.archetypeDetails = archetypeDetails;
            this.feederAudit = feederAudit;
        }
Beispiel #20
0
        protected Locatable(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid,
                            AssumedTypes.List <Link> links, Archetyped archetypeDetails, FeederAudit feederAudit)
            : this()
        {
            Check.Require(name != null, "name must not be null");
            Check.Require(!string.IsNullOrEmpty(archetypeNodeId), "archetype_node_id must not be null or empty");

            this.name             = name;
            this.archetypeNodeId  = archetypeNodeId;
            this.uid              = uid;
            this.links            = links;
            this.archetypeDetails = archetypeDetails;
            this.feederAudit      = feederAudit;
        }
Beispiel #21
0
        /// <summary>
        /// Return the row names, i.e. the list of each cluster name. Returns an empty list of DvText when this.Rows is empty.
        /// </summary>
        /// <returns></returns>
        public AssumedTypes.List <DataTypes.Text.DvText> RowNames()
        {
            if (rowNames == null)
            {
                rowNames = new OpenEhr.AssumedTypes.List <OpenEhr.RM.DataTypes.Text.DvText>();
                if (this.RowCount() > 0)
                {
                    foreach (Cluster cluster in this.Rows)
                    {
                        rowNames.Add(cluster.Name);
                    }
                }
            }

            DesignByContract.Check.Ensure(rowNames != null, "rowNames must not be null.");
            return(rowNames);
        }
Beispiel #22
0
        /// <summary>
        /// Retrieve the names of all items. If the Items is null or empty, returns an empty list of DvText.
        /// </summary>
        /// <returns></returns>
        public AssumedTypes.List <DataTypes.Text.DvText> Names()
        {
            // CM: 11/08/08 when this.ItemCount() == 0, return an empty list
            if (names == null)
            {
                names = new OpenEhr.AssumedTypes.List <OpenEhr.RM.DataTypes.Text.DvText>();

                if (this.ItemCount() > 0)
                {
                    foreach (Locatable l in this.Items)
                    {
                        names.Add(l.Name);
                    }
                }
            }

            return(names);
        }
Beispiel #23
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="language">The localised language in which the items in this description item are written. Coded from
        /// openEHR Code Set “languages”.</param>
        /// <param name="purpose">Purpose of the resource.</param>
        /// <param name="keywords">Keywords which characterise this resource, used e.g. for indexing and searching.</param>
        /// <param name="use">Description of the uses of the resource, i.e. contexts in which it could be used.</param>
        /// <param name="misuse">Description of any misuses of the resource, i.e. contexts in which it should not be used.</param>
        /// <param name="copyright">Optional copyright statement for the resource as a knowledge resource.</param>
        /// <param name="originalResourceUri">URIs of original clinical document(s) or description of which resource is a formalisation,
        /// in the language of this description item; keyed by meaning.</param>
        /// <param name="otherDetails">Additional language-senstive resource metadata, as a list of name/value pairs.</param>
        public ResourceDescriptionItem(CodePhrase language, string purpose, AssumedTypes.List <string> keywords,
                                       string use, string misuse, string copyright, AssumedTypes.Hash <string, string> originalResourceUri,
                                       AssumedTypes.Hash <string, string> otherDetails) : this(language, purpose)
        {
            Check.Require(use == null || use != string.Empty, "if use is not null, it must not be empty");
            Check.Require(misuse == null || misuse != string.Empty, "if misuse is not null, it must not be empty");
            Check.Require(copyright == null || copyright != string.Empty, "if copyright is not null, it must not be empty");

            this.language            = language;
            this.purpose             = purpose;
            this.purpose             = purpose;
            this.keywords            = keywords;
            this.use                 = use;
            this.misuse              = misuse;
            this.copyright           = copyright;
            this.originalResourceUri = originalResourceUri;
            this.otherDetails        = otherDetails;
        }
Beispiel #24
0
        public Attestation(string systemId, DataTypes.Quantity.DateTime.DvDateTime timeCommitted,
                           DataTypes.Text.DvCodedText changedType, PartyProxy committer, DataTypes.Text.DvText description,
                           DataTypes.Encapsulated.DvMultimedia attestedView, string proof,
                           AssumedTypes.List <DataTypes.Uri.DvEhrUri> items, DataTypes.Text.DvText reason, bool isPending)
            : base(systemId, timeCommitted, changedType, committer, description)
        {
            Check.Require(items == null | items.Count > 0, "if items is not null, it must not be empty.");
            Check.Require(reason != null, "reason must not be null.");

            this.attestedView = attestedView;
            this.proof        = proof;
            this.items        = items;
            this.reason       = reason;
            this.isPending    = isPending;
            this.isPendingSet = true;

            this.CheckDefaultInvariants();
        }
Beispiel #25
0
        public Attestation(string systemId, DataTypes.Quantity.DateTime.DvDateTime timeCommitted, 
            DataTypes.Text.DvCodedText changedType, PartyProxy committer, DataTypes.Text.DvText description,
            DataTypes.Encapsulated.DvMultimedia attestedView, string proof, 
            AssumedTypes.List<DataTypes.Uri.DvEhrUri> items, DataTypes.Text.DvText reason, bool isPending)
            : base(systemId, timeCommitted, changedType, committer, description)
        {
            Check.Require(items == null | items.Count >0, "if items is not null, it must not be empty.");
            Check.Require(reason != null, "reason must not be null.");

            this.attestedView = attestedView;
            this.proof = proof;
            this.items = items;
            this.reason = reason;
            this.isPending = isPending;
            this.isPendingSet = true;

            this.CheckDefaultInvariants();
        }
Beispiel #26
0
        protected Entry(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid,
           Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit,
            CodePhrase language, CodePhrase encoding, PartyProxy subject, PartyProxy proider,
            Participation[] otherParticipations, ObjectRef workflowId)
            : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit)
        {
            Check.Require(language != null, "language must not be null");
            Check.Require(encoding != null, "encoding must not be null");
            Check.Require(subject != null, "subject must not be null");

            this.language = language;
            this.encoding = encoding;
            this.subject = subject;
            this.provider = proider;
            if (otherParticipations != null)
                this.otherParticipations = new OpenEhr.AssumedTypes.List<Participation>(otherParticipations);
            this.workflowId = workflowId;
        }
Beispiel #27
0
        /// <summary>
        /// List of all keys used in this term.
        /// </summary>
        /// <returns></returns>
        public AssumedTypes.Set <string> Keys()
        {
            Check.Require(this.Items != null, string.Format(CommonStrings.XMustNotBeNull, "ArchetypeTerm.Items"));

            AssumedTypes.List <string> itemsKeys = this.Items.Keys;
            Check.Ensure(itemsKeys != null, "Ensure keys must not be null.");

            System.Collections.Generic.List <string> genericList = new List <string>();
            foreach (string eachKey in itemsKeys)
            {
                genericList.Add(eachKey);
            }

            AssumedTypes.Set <string> keys = new OpenEhr.AssumedTypes.Set <string>(genericList);

            Check.Ensure(keys != null, "keys must not be null.");

            return(keys);
        }
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="language">The localised language in which the items in this description item are written. Coded from
        /// openEHR Code Set “languages”.</param>
        /// <param name="purpose">Purpose of the resource.</param>
        /// <param name="keywords">Keywords which characterise this resource, used e.g. for indexing and searching.</param>
        /// <param name="use">Description of the uses of the resource, i.e. contexts in which it could be used.</param>
        /// <param name="misuse">Description of any misuses of the resource, i.e. contexts in which it should not be used.</param>
        /// <param name="copyright">Optional copyright statement for the resource as a knowledge resource.</param>
        /// <param name="originalResourceUri">URIs of original clinical document(s) or description of which resource is a formalisation,
        /// in the language of this description item; keyed by meaning.</param>
        /// <param name="otherDetails">Additional language-senstive resource metadata, as a list of name/value pairs.</param>
        public ResourceDescriptionItem(CodePhrase language, string purpose, AssumedTypes.List<string> keywords,
            string use, string misuse, string copyright, AssumedTypes.Hash<string, string> originalResourceUri,
            AssumedTypes.Hash<string, string> otherDetails)
            : this(language, purpose)
        {
            Check.Require(use == null || use != string.Empty, "if use is not null, it must not be empty");
            Check.Require(misuse == null || misuse != string.Empty, "if misuse is not null, it must not be empty");
            Check.Require(copyright == null || copyright != string.Empty, "if copyright is not null, it must not be empty");

            this.language = language;
            this.purpose = purpose;
            this.purpose = purpose;
            this.keywords = keywords;
            this.use = use;
            this.misuse = misuse;
            this.copyright = copyright;
            this.originalResourceUri = originalResourceUri;
            this.otherDetails = otherDetails;
        }
Beispiel #29
0
        protected override void ReadXmlBase(XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.LocalName == "rows")
            {
                LocatableList <Representation.Cluster> rows =
                    new LocatableList <OpenEhr.RM.DataStructures.ItemStructure.Representation.Cluster>();

                while (reader.LocalName == "rows")
                {
                    OpenEhr.RM.DataStructures.ItemStructure.Representation.Cluster aCluster =
                        new OpenEhr.RM.DataStructures.ItemStructure.Representation.Cluster();
                    aCluster.ReadXml(reader);
                    aCluster.Parent = this;
                    rows.Add(aCluster);
                }
                this.rows = rows;
            }
        }
Beispiel #30
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            if (reader.LocalName != "items")
            {
                throw new ValidationException("Expected local name is items, but it is " + reader.LocalName);
            }

            this.items = new OpenEhr.AssumedTypes.List <RevisionHistoryItem>();

            while (reader.LocalName == "items")
            {
                RevisionHistoryItem item = new RevisionHistoryItem();
                item.ReadXml(reader);
                this.items.Add(item);
            }

            // TODO: sort the items
        }
Beispiel #31
0
        /// <summary>
        /// True if there is a column with name aKey
        /// </summary>
        /// <param name="aKey"></param>
        /// <returns></returns>
        public bool HasColumnWithName(string aKey)
        {
            DesignByContract.Check.Require(!string.IsNullOrEmpty(aKey), "aKey must not be null or empty.");

            if (this.ColumnCount() == 0)
            {
                return(false);
            }

            AssumedTypes.List <DataTypes.Text.DvText> columnNames = this.ColumnNames();

            foreach (DataTypes.Text.DvText name in columnNames)
            {
                if (name.Value == aKey)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #32
0
        public EventContext(DvDateTime startTime, DvDateTime endTime,
            DvCodedText setting, string location, PartyIdentified healthCareFacility,
            ItemStructure otherContext, Participation[] participations)
            : this()
        {
            Check.Require(startTime != null, "start_time must not be null");
            Check.Require(setting != null, "setting must not be null");

            this.startTime = startTime;
            this.endTime = endTime;
            this.setting = setting;
            this.location = location;
            this.healthCareFacility = healthCareFacility;
            this.otherContext = otherContext;
            if (this.otherContext != null)
                this.otherContext.Parent = this;
            if (participations != null)
                this.participations = new OpenEhr.AssumedTypes.List<Participation>(participations);

            SetAttributeDictionary();
            this.CheckInvariants();
        }
Beispiel #33
0
        /// <summary>
        /// Return the column names. Returns an empty list of DvText if the ColumnCount is 0
        /// </summary>
        /// <returns></returns>
        public AssumedTypes.List <DataTypes.Text.DvText> ColumnNames()
        {
            DesignByContract.Check.Require(this.ColumnCount() == 0 ^ this.RowCount() > 0,
                                           "If ColumnCount ==0, RowCount must be zero. If ColumnCount >0, RowCount must be > 0");

            if (columnNames == null)
            {
                columnNames = new AssumedTypes.List <OpenEhr.RM.DataTypes.Text.DvText>();
                if (this.ColumnCount() > 0)
                {
                    Cluster aRow = this.Rows[0];
                    DesignByContract.Check.Assert(aRow != null, "aRow must not be null.");

                    for (int i = 1; i < aRow.Items.Count; i++)
                    {
                        columnNames.Add(aRow.Items[i].Name);
                    }
                }
            }

            DesignByContract.Check.Ensure(columnNames != null, "columnNames must not be null.");
            return(columnNames);
        }
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "version_id", "Expected local name is 'version_id', not " + reader.LocalName);
            this.versionId = new OpenEhr.RM.Support.Identification.ObjectVersionId();
            this.versionId.ReadXml(reader);

            Check.Assert(reader.LocalName == "audits", "Expected local name is 'audits', not " + reader.LocalName);
            while (reader.LocalName == "audits")
            {
                if (this.audits == null)
                {
                    this.audits = new OpenEhr.AssumedTypes.List <AuditDetails>();
                }

                AuditDetails auditDetails = new AuditDetails();
                auditDetails.ReadXml(reader);

                this.audits.Add(auditDetails);
            }
        }
        /// <summary>
        /// Total list of languages available in this resource, derived from original_language and
        /// translations.
        /// </summary>
        public AssumedTypes.List <string> LanguagesAvailable()
        {
            if (this.languagesAvailable != null && this.languagesAvailable.Count > 0)
            {
                return(this.languagesAvailable);
            }

            this.languagesAvailable = new OpenEhr.AssumedTypes.List <string>();
            this.languagesAvailable.Add(this.OriginalLanguage.CodeString);

            if (this.Translations != null)
            {
                foreach (string language in this.Translations.Keys)
                {
                    this.languagesAvailable.Add(language);
                }
            }

            DesignByContract.Check.Ensure(this.languagesAvailable.Count > 0, "Must have at least one available language");
            DesignByContract.Check.Ensure(this.languagesAvailable.Has(this.OriginalLanguage.CodeString),
                                          "AuthoredResource available language(s) must contrain original language");

            return(this.languagesAvailable);
        }
Beispiel #36
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            //reader.ReadStartElement();
            //reader.MoveToContent();

            string openEhrNamespace = RmXmlSerializer.OpenEhrNamespace;

            Check.Assert(reader.LocalName == "value", "reader.LocalName must be 'value'");
            //this.value = reader.ReadElementString("value", openEhrNamespace);
            //this.valueSet = true;
            SetValue(reader.ReadElementString("value", openEhrNamespace));

            reader.MoveToContent();

            if (reader.LocalName == "hyperlink")
            {
                string linkType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                if (linkType != null)
                {
                    this.hyperlink = new OpenEhr.RM.DataTypes.Uri.DvEhrUri();
                }
                else
                {
                    this.hyperlink = new OpenEhr.RM.DataTypes.Uri.DvUri();
                }
                this.hyperlink.ReadXml(reader);
            }

            if (reader.LocalName == "formatting")
            {
                this.formatting = reader.ReadElementString("formatting", openEhrNamespace);
                //this.formattingSet = true;
            }

            // TODO: TermMapping
            if (reader.LocalName == "mappings")
            {
                this.mappings = new OpenEhr.AssumedTypes.List <TermMapping>(); //new List<TermMapping>();
                do
                {
                    TermMapping mapping = new TermMapping();
                    mapping.ReadXml(reader);
                    this.mappings.Add(mapping);
                } while (reader.LocalName == "mapping" && reader.NodeType == System.Xml.XmlNodeType.Element);
            }

            // language
            if (reader.LocalName == "language")
            {
                if (this.language == null)
                {
                    this.language = new CodePhrase();
                }
                this.language.ReadXml(reader);
                //this.languageSet = true;
            }

            // encoding
            if (reader.LocalName == "encoding")
            {
                if (this.encoding == null)
                {
                    this.encoding = new CodePhrase();
                }
                this.encoding.ReadXml(reader);
                //this.encodingSet = true;
            }
        }
Beispiel #37
0
        /// <summary>
        /// Return the row names, i.e. the list of each cluster name. Returns an empty list of DvText when this.Rows is empty. 
        /// </summary>
        /// <returns></returns>
        public AssumedTypes.List<DataTypes.Text.DvText> RowNames()
        {
            if (rowNames == null)
            {
                rowNames = new OpenEhr.AssumedTypes.List<OpenEhr.RM.DataTypes.Text.DvText>();
                if (this.RowCount() > 0)
                {
                    foreach (Cluster cluster in this.Rows)
                    {
                        rowNames.Add(cluster.Name);
                    }
                }
            }

            DesignByContract.Check.Ensure(rowNames != null, "rowNames must not be null.");
            return rowNames;
        }
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "language", "Expected local name is 'language', not " + reader.LocalName);
            this.language = new CodePhrase();
            this.language.ReadXml(reader);

            Check.Assert(reader.LocalName == "purpose", "Expected local name is 'purpose', not " + reader.LocalName);
            this.purpose = reader.ReadElementString("purpose", RmXmlSerializer.OpenEhrNamespace);
            reader.MoveToContent();

            while (reader.LocalName == "keywords")
            {
                if (this.keywords == null)
                    this.keywords = new OpenEhr.AssumedTypes.List<string>();
                this.keywords.Add(reader.ReadElementString("keywords", RmXmlSerializer.OpenEhrNamespace));
                reader.MoveToContent();
            }

            if (reader.LocalName == "use")
            {
                // TODO don't need this when the xml instance is fixed
                if (reader.IsEmptyElement)
                    reader.Skip();
                else
                    this.use = reader.ReadElementString("use", RmXmlSerializer.OpenEhrNamespace);
                reader.MoveToContent();
            }

            if (reader.LocalName == "misuse")
            {
                // TODO don't need this when the xml instance is fixed
                if (reader.IsEmptyElement)
                    reader.Skip();
                else
                    this.misuse = reader.ReadElementString("misuse", RmXmlSerializer.OpenEhrNamespace);
                reader.MoveToContent();
            }

            if (reader.LocalName == "copyright")
            {
                // TODO don't need this when the xml instance is fixed
                if (reader.IsEmptyElement)
                    reader.Skip();
                else
                    this.Copyright = reader.ReadElementString("copyright", RmXmlSerializer.OpenEhrNamespace);
                reader.MoveToContent();
            }

            if (reader.LocalName == "original_resource_uri")
            {
                System.Collections.Generic.Dictionary<string, string> originalResourceUriDic =
                    new System.Collections.Generic.Dictionary<string, string>();
                while (reader.LocalName == "original_resource_uri")
                {
                    string id = reader.GetAttribute("id");
                    if (string.IsNullOrEmpty(id))
                        throw new ValidationException("original_resource_uri must have id attribute and its value must not be null or empty.");
                    string value = reader.ReadElementString("original_resource_uri", RmXmlSerializer.OpenEhrNamespace);
                    reader.MoveToContent();
                    if (string.IsNullOrEmpty(value))
                        throw new ValidationException("original_resource_uri value must not be null or empty.");

                    originalResourceUriDic.Add(id, value);
                }
                if (originalResourceUriDic.Count <= 0)
                    throw new ValidationException("originalResourceUriDic must not be empty.");

                this.originalResourceUri = new OpenEhr.AssumedTypes.Hash<string, string>(originalResourceUriDic);
            }

            if (reader.LocalName == "other_details")
            {
                System.Collections.Generic.Dictionary<string, string> otherDetailsUriDic =
                    new System.Collections.Generic.Dictionary<string, string>();
                while (reader.LocalName == "other_details")
                {
                    string id = reader.GetAttribute("id");
                    if (string.IsNullOrEmpty(id))
                        throw new ValidationException("original_resource_uri must have id attribute and its value must not be null or empty.");
                    string value = reader.ReadElementString("original_resource_uri", RmXmlSerializer.OpenEhrNamespace);
                    reader.MoveToContent();
                    if (string.IsNullOrEmpty(value))
                        throw new ValidationException("original_resource_uri value must not be null or empty.");

                    otherDetailsUriDic.Add(id, value);
                }
                if (otherDetailsUriDic.Count <= 0)
                    throw new ValidationException("originalResourceUriDic must not be empty.");

                this.otherDetails = new OpenEhr.AssumedTypes.Hash<string, string>(otherDetailsUriDic);
            }

            if (!reader.IsStartElement())
            {
                reader.ReadEndElement();
                reader.MoveToContent();
            }
        }
Beispiel #39
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            //reader.ReadStartElement();
            //reader.MoveToContent();

            string openEhrNamespace = RmXmlSerializer.OpenEhrNamespace;

            Check.Assert(reader.LocalName == "value", "reader.LocalName must be 'value'");
            //this.value = reader.ReadElementString("value", openEhrNamespace);
            //this.valueSet = true;
            SetValue(reader.ReadElementString("value", openEhrNamespace));

            reader.MoveToContent();

            if (reader.LocalName == "hyperlink")
            {
                string linkType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                if (linkType != null)
                    this.hyperlink = new OpenEhr.RM.DataTypes.Uri.DvEhrUri();
                else
                    this.hyperlink = new OpenEhr.RM.DataTypes.Uri.DvUri();
                this.hyperlink.ReadXml(reader);
            }

            if (reader.LocalName == "formatting")
            {
                this.formatting = reader.ReadElementString("formatting", openEhrNamespace);
                //this.formattingSet = true;
            }

               // TODO: TermMapping
            if (reader.LocalName == "mappings")
            {
                this.mappings = new OpenEhr.AssumedTypes.List<TermMapping>(); //new List<TermMapping>();
                do
                {
                    TermMapping mapping = new TermMapping();
                    mapping.ReadXml(reader);
                    this.mappings.Add(mapping);

                } while (reader.LocalName == "mapping" && reader.NodeType == System.Xml.XmlNodeType.Element);
            }

            // language
            if (reader.LocalName == "language")
            {
                if (this.language == null)
                    this.language = new CodePhrase();
                this.language.ReadXml(reader);
                //this.languageSet = true;
            }

            // encoding
            if (reader.LocalName == "encoding")
            {
                if (this.encoding == null)
                    this.encoding = new CodePhrase();
                this.encoding.ReadXml(reader);
                //this.encodingSet = true;
            }
        }
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "original_author", "Expected local name is 'original_author', not " + reader.LocalName);
            this.originalAuthor = GetHashData(reader, "original_author");
            reader.MoveToContent();

            string otherContributors = "other_contributors";

            if (reader.LocalName == otherContributors)
            {
                this.otherContributors = new OpenEhr.AssumedTypes.List <string>();
                do
                {
                    this.otherContributors.Add(reader.ReadElementString(otherContributors, RmXmlSerializer.OpenEhrNamespace));
                    reader.MoveToContent();
                } while (reader.LocalName == otherContributors);
            }

            string lifeCycle = "lifecycle_state";

            Check.Assert(reader.LocalName == lifeCycle, "Expected reader.LocalName is " + lifeCycle + ", not " + reader.LocalName);
            this.lifecycleState = reader.ReadElementString(lifeCycle, RmXmlSerializer.OpenEhrNamespace);
            reader.MoveToContent();

            string resourcePackageUriNodeName = "resource_package_uri";

            if (reader.LocalName == resourcePackageUriNodeName)
            {
                this.resourcePackageUri = reader.ReadElementString(resourcePackageUriNodeName, RmXmlSerializer.OpenEhrNamespace);
                reader.MoveToContent();
            }

            string otherDetailsNodeName = "other_details";

            if (reader.LocalName == otherDetailsNodeName)
            {
                this.otherDetails = GetHashData(reader, otherDetailsNodeName);
            }

            string detailsNodeName = "details";

            if (reader.LocalName == detailsNodeName)
            {
                System.Collections.Generic.Dictionary <string, ResourceDescriptionItem> detailsDic =
                    new System.Collections.Generic.Dictionary <string, ResourceDescriptionItem>();
                do
                {
                    ResourceDescriptionItem item = new ResourceDescriptionItem();
                    item.ReadXml(reader);

                    detailsDic.Add(item.Language.CodeString, item);
                } while (reader.LocalName == detailsNodeName);

                if (detailsDic.Count > 0)
                {
                    this.details = new OpenEhr.AssumedTypes.Hash <ResourceDescriptionItem, string>(detailsDic);
                }
            }

            string parentResourceNodeName = "parent_resource";

            if (reader.LocalName == parentResourceNodeName)
            {
                string resourceType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);

                this.parentResource = RmFactory.Instance.AuthoredResource(resourceType);
                DesignByContract.Check.Assert(parentResource != null, "must have an object with the type of " + resourceType);

                this.parentResource.ReadXml(reader);
            }

            if (!reader.IsStartElement())
            {
                reader.ReadEndElement();
                reader.MoveToContent();
            }
        }
Beispiel #41
0
        protected override void ReadXmlBase(XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.LocalName == "rows")
            {
                LocatableList<Representation.Cluster> rows =
                    new LocatableList<OpenEhr.RM.DataStructures.ItemStructure.Representation.Cluster>();

                while (reader.LocalName == "rows")
                {
                    OpenEhr.RM.DataStructures.ItemStructure.Representation.Cluster aCluster =
                       new OpenEhr.RM.DataStructures.ItemStructure.Representation.Cluster();
                    aCluster.ReadXml(reader);
                    aCluster.Parent = this;
                    rows.Add(aCluster);
                }
                this.rows = rows;
            }
        }
 public CSingleAttribute(string rmAttributeName, AssumedTypes.Interval <int> existence,
                         AssumedTypes.List <CObject> children) : base(rmAttributeName, existence, children)
 {
 }
Beispiel #43
0
        internal void ReadXml(XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            DesignByContract.Check.Assert(reader.LocalName == "start_time",
                "Expected LocalName is 'start_time', but it is " + reader.LocalName);
            this.startTime = new OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime();
            this.startTime.ReadXml(reader);

            if (reader.LocalName == "end_time")
            {
                this.endTime = new OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime();
                this.endTime.ReadXml(reader);
            }

            if (reader.LocalName == "location")
            {
                this.location = reader.ReadElementString("location", RmXmlSerializer.OpenEhrNamespace);
            }

            DesignByContract.Check.Assert(reader.LocalName == "setting",
                "Expected LocalName is 'setting', but it is " + reader.LocalName);
            this.setting = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            this.setting.ReadXml(reader);

            if (reader.LocalName == "other_context")
            {
                string otherContextType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                this.otherContext = OpenEhr.RM.Common.Archetyped.Impl.Locatable.GetLocatableObjectByType(otherContextType)
                    as ItemStructure;
                if (this.otherContext == null)
                    throw new InvalidOperationException("otherContextType must be subtype of ItemStructure " + otherContextType);
                this.otherContext.ReadXml(reader);
                this.otherContext.Parent = this;
            }

            if (reader.LocalName == "health_care_facility")
            {
                this.healthCareFacility = new OpenEhr.RM.Common.Generic.PartyIdentified();
                this.healthCareFacility.ReadXml(reader);

            }

            if (reader.LocalName == "participations")
            {
                this.participations = new OpenEhr.AssumedTypes.List<OpenEhr.RM.Common.Generic.Participation>();
                do
                {
                    OpenEhr.RM.Common.Generic.Participation p = new OpenEhr.RM.Common.Generic.Participation();
                    p.ReadXml(reader);
                    this.participations.Add(p);

                } while (reader.LocalName == "participations");
            }

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

            this.SetAttributeDictionary();
        }
Beispiel #44
0
        internal void ReadXml(XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            if (reader.LocalName == "originating_system_item_ids")
            {
                this.originatingSystemItemIds = new OpenEhr.AssumedTypes.List<OpenEhr.RM.DataTypes.Basic.DvIdentifier>();
                do
                {
                    OpenEhr.RM.DataTypes.Basic.DvIdentifier id = new OpenEhr.RM.DataTypes.Basic.DvIdentifier();
                    id.ReadXml(reader);
                    this.originatingSystemItemIds.Add(id);
                } while (reader.LocalName == "originating_system_item_ids" && reader.NodeType == System.Xml.XmlNodeType.Element);

            }

            if (reader.LocalName == "feeder_system_item_ids")
            {
                this.feederSystemItemIds = new OpenEhr.AssumedTypes.List<OpenEhr.RM.DataTypes.Basic.DvIdentifier>();
                do
                {
                    OpenEhr.RM.DataTypes.Basic.DvIdentifier id = new OpenEhr.RM.DataTypes.Basic.DvIdentifier();
                    id.ReadXml(reader);
                    this.feederSystemItemIds.Add(id);
                } while (reader.LocalName == "feeder_system_item_ids" && reader.NodeType == System.Xml.XmlNodeType.Element);

            }

            if (reader.LocalName == "original_content")
            {
                string originalContentType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                Check.Assert(!string.IsNullOrEmpty(originalContentType),
                    "the type of original_content must not be null or empty.");

                int i = originalContentType.IndexOf(":");
                if (i >= 0)
                    originalContentType = originalContentType.Substring(i + 1);

                if (originalContentType == "DV_MULTIMEDIA")
                    this.originalContent = new DvMultimedia();
                else if (originalContentType == "DV_PARSABLE")
                    this.originalContent = new DvParsable();
                else
                    throw new InvalidOperationException("originalContent type must be either DV_MULTIMEDIA or " +
                        "DV_PARSABLE (type: " + originalContentType + ")");

                this.originalContent.ReadXml(reader);
            }

            Check.Assert(reader.LocalName == "originating_system_audit",
                "Expected LocalName is 'originating_system_audit', but it is " + reader.LocalName);
            this.originatingSystemAudit = new FeederAuditDetails();
            this.originatingSystemAudit.ReadXml(reader);

            if (reader.LocalName == "feeder_system_audit")
            {
                this.feederSystemAudit = new FeederAuditDetails();
                this.feederSystemAudit.ReadXml(reader);
            }

            if (!reader.IsStartElement())
            {
                reader.ReadEndElement();
            }

            reader.MoveToContent();
        }
Beispiel #45
0
        /// <summary>
        /// Retrieve the names of all items. If the Items is null or empty, returns an empty list of DvText.
        /// </summary>
        /// <returns></returns>
        public AssumedTypes.List<DataTypes.Text.DvText> Names()
        {
            // CM: 11/08/08 when this.ItemCount() == 0, return an empty list
            if (names == null)
            {
                names = new OpenEhr.AssumedTypes.List<OpenEhr.RM.DataTypes.Text.DvText>();

                if (this.ItemCount() > 0)
                {
                    foreach (Locatable l in this.Items)
                    {
                        names.Add(l.Name);
                    }
                }
            }

            return names;
        }
Beispiel #46
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.LocalName == "items")
            {
                LocatableList<Element> items = new LocatableList<Element>();

                do
                {
                    Element element = new Element();
                    element.ReadXml(reader);
                    element.Parent = this;
                    items.Add(element);
                // Added checking on reader.NodeType == Element is because ItemList xml instance
                // is something like: <items> <items xsi:type='ELEMENT'>..</items></items>.
                // After reading all element contents, the reader.LocalName is still items,
                // but the reader NodeType is EndElement. This situation is similar as Section, ItemTable
                } while (reader.LocalName == "items" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.items = items;
            }

            reader.MoveToContent();
        }
Beispiel #47
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "version_id", "Expected local name is 'version_id', not " + reader.LocalName);
            this.versionId = new OpenEhr.RM.Support.Identification.ObjectVersionId();
            this.versionId.ReadXml(reader);

            Check.Assert(reader.LocalName == "audits", "Expected local name is 'audits', not " + reader.LocalName);
            while (reader.LocalName == "audits")
            {
                if (this.audits == null)
                    this.audits = new OpenEhr.AssumedTypes.List<AuditDetails>();

                AuditDetails auditDetails = new AuditDetails();
                auditDetails.ReadXml(reader);

                this.audits.Add(auditDetails);
            }
        }
Beispiel #48
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            if (reader.LocalName != "items")
                throw new ValidationException("Expected local name is items, but it is " + reader.LocalName);

            this.items = new OpenEhr.AssumedTypes.List<RevisionHistoryItem>();

            while (reader.LocalName == "items")
            {
                RevisionHistoryItem item = new RevisionHistoryItem();
                item.ReadXml(reader);
                this.items.Add(item);
            }

            // TODO: sort the items
        }
Beispiel #49
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.NodeType == System.Xml.XmlNodeType.Element && reader.LocalName == "folders")
            {
                LocatableList<Folder> folders = new LocatableList<Folder>();
                do
                {
                    Folder folder = new Folder();

                    folder.ReadXml(reader);

                    folder.Parent = this;
                    folders.Add(folder);
                } while (reader.LocalName == "folders" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.folders = folders;
            }

            if (reader.LocalName == "items")
            {
                AssumedTypes.List<ObjectRef> items = new AssumedTypes.List<ObjectRef>();
                do
                {
                    ObjectRef item = new ObjectRef();

                    item.ReadXml(reader);
                    items.Add(item);
                } while (reader.LocalName == "items" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.items = items;
            }
        }
Beispiel #50
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            DesignByContract.Check.Assert(reader.LocalName == "items",
                "Expected LocalName is 'items' rather than " + reader.LocalName);

            OpenEhr.AssumedTypes.Impl.LocatableList < Item >  items = new OpenEhr.AssumedTypes.Impl.LocatableList<Item>();
            while (reader.LocalName == "items" && reader.NodeType== System.Xml.XmlNodeType.Element)
            {
                string itemType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                Item anItem = Item.GetLocatableObjectByType(itemType) as Item;
                if (anItem == null)
                    throw new InvalidOperationException("itemType must be type of Item: " + itemType);
                anItem.ReadXml(reader);

                anItem.Parent = this;
                items.Add(anItem);
            }
            this.items = items;
        }
Beispiel #51
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            Check.Assert(reader.LocalName == "language", "Expected LocalName is 'language' rather than " +
                reader.LocalName);
            this.language = new OpenEhr.RM.DataTypes.Text.CodePhrase();
            this.language.ReadXml(reader);

            Check.Assert(reader.LocalName == "encoding", "Expected LocalName is 'encoding' rather than " +
                reader.LocalName);
            this.encoding = new OpenEhr.RM.DataTypes.Text.CodePhrase();
            this.encoding.ReadXml(reader);

            Check.Assert(reader.LocalName == "subject", "Expected LocalName is 'subject' rather than " +
                reader.LocalName);
            string subjectType = RmXmlSerializer.ReadXsiType(reader);
            this.subject = RmFactory.PartyProxy(subjectType);

            this.subject.ReadXml(reader);

            if (reader.LocalName == "provider")
            {
                string providerType = RmXmlSerializer.ReadXsiType(reader);
                this.provider = RmFactory.PartyProxy(providerType);

                this.provider.ReadXml(reader);
            }

            if (reader.LocalName == "other_participations")
            {
                this.otherParticipations = new OpenEhr.AssumedTypes.List<Participation>();
                do
                {
                    Participation p = new Participation();
                    p.ReadXml(reader);

                    this.otherParticipations.Add(p);

                } while (reader.LocalName == "other_participations");
            }

            if (reader.LocalName == "work_flow_id")
            {
                string workFlowIdType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);

                // CM: 06/09/10 when workFlowIdType is null or empty, it's type of OBJECT_REF
                if (string.IsNullOrEmpty(workFlowIdType))
                    this.workflowId = new ObjectRef();
                else
                    this.workflowId = ObjectRef.GetObjectRefByType(workFlowIdType);

                this.workflowId.ReadXml(reader);

            }
        }
Beispiel #52
0
        /// <summary>
        /// Return the column names. Returns an empty list of DvText if the ColumnCount is 0
        /// </summary>
        /// <returns></returns>
        public AssumedTypes.List<DataTypes.Text.DvText> ColumnNames()
        {
            DesignByContract.Check.Require(this.ColumnCount() == 0 ^ this.RowCount()>0,
                "If ColumnCount ==0, RowCount must be zero. If ColumnCount >0, RowCount must be > 0");

            if (columnNames == null)
            {
                columnNames = new AssumedTypes.List<OpenEhr.RM.DataTypes.Text.DvText>();
                if (this.ColumnCount() > 0)
                {
                    Cluster aRow = this.Rows[0];
                    DesignByContract.Check.Assert(aRow != null, "aRow must not be null.");

                    for (int i = 1; i < aRow.Items.Count; i++)
                    {
                        columnNames.Add(aRow.Items[i].Name);
                    }
                }
            }

            DesignByContract.Check.Ensure(columnNames != null, "columnNames must not be null.");
            return columnNames;
        }
Beispiel #53
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "original_author", "Expected local name is 'original_author', not " + reader.LocalName);
            this.originalAuthor = GetHashData(reader, "original_author");
            reader.MoveToContent();

            string otherContributors = "other_contributors";
            if (reader.LocalName == otherContributors)
            {
                this.otherContributors = new OpenEhr.AssumedTypes.List<string>();
                do
                {
                    this.otherContributors.Add(reader.ReadElementString(otherContributors, RmXmlSerializer.OpenEhrNamespace));
                    reader.MoveToContent();
                } while (reader.LocalName == otherContributors);
            }

            string lifeCycle = "lifecycle_state";
            Check.Assert(reader.LocalName == lifeCycle, "Expected reader.LocalName is " + lifeCycle + ", not " + reader.LocalName);
            this.lifecycleState = reader.ReadElementString(lifeCycle, RmXmlSerializer.OpenEhrNamespace);
            reader.MoveToContent();

            string resourcePackageUriNodeName = "resource_package_uri";
            if (reader.LocalName == resourcePackageUriNodeName)
            {
                this.resourcePackageUri = reader.ReadElementString(resourcePackageUriNodeName, RmXmlSerializer.OpenEhrNamespace);
                reader.MoveToContent();
            }

            string otherDetailsNodeName = "other_details";
            if (reader.LocalName == otherDetailsNodeName)
            {
                this.otherDetails = GetHashData(reader, otherDetailsNodeName);
            }

            string detailsNodeName = "details";
            if (reader.LocalName == detailsNodeName)
            {
                System.Collections.Generic.Dictionary<string, ResourceDescriptionItem> detailsDic =
                    new System.Collections.Generic.Dictionary<string, ResourceDescriptionItem>();
                do
                {
                    ResourceDescriptionItem item = new ResourceDescriptionItem();
                    item.ReadXml(reader);

                    detailsDic.Add(item.Language.CodeString, item);

                } while (reader.LocalName == detailsNodeName);

                if (detailsDic.Count > 0)
                    this.details = new OpenEhr.AssumedTypes.Hash<ResourceDescriptionItem, string>(detailsDic);
            }

            string parentResourceNodeName = "parent_resource";
            if (reader.LocalName == parentResourceNodeName)
            {
                string resourceType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);

                this.parentResource = RmFactory.Instance.AuthoredResource(resourceType);
                DesignByContract.Check.Assert(parentResource != null, "must have an object with the type of "+resourceType);

                this.parentResource.ReadXml(reader);
            }

            if (!reader.IsStartElement())
            {
                reader.ReadEndElement();
                reader.MoveToContent();
            }
        }
Beispiel #54
0
        internal void ReadXml(XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            if (reader.LocalName == "originating_system_item_ids")
            {
                this.originatingSystemItemIds = new OpenEhr.AssumedTypes.List <OpenEhr.RM.DataTypes.Basic.DvIdentifier>();
                do
                {
                    OpenEhr.RM.DataTypes.Basic.DvIdentifier id = new OpenEhr.RM.DataTypes.Basic.DvIdentifier();
                    id.ReadXml(reader);
                    this.originatingSystemItemIds.Add(id);
                } while (reader.LocalName == "originating_system_item_ids" && reader.NodeType == System.Xml.XmlNodeType.Element);
            }

            if (reader.LocalName == "feeder_system_item_ids")
            {
                this.feederSystemItemIds = new OpenEhr.AssumedTypes.List <OpenEhr.RM.DataTypes.Basic.DvIdentifier>();
                do
                {
                    OpenEhr.RM.DataTypes.Basic.DvIdentifier id = new OpenEhr.RM.DataTypes.Basic.DvIdentifier();
                    id.ReadXml(reader);
                    this.feederSystemItemIds.Add(id);
                } while (reader.LocalName == "feeder_system_item_ids" && reader.NodeType == System.Xml.XmlNodeType.Element);
            }

            if (reader.LocalName == "original_content")
            {
                string originalContentType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                Check.Assert(!string.IsNullOrEmpty(originalContentType),
                             "the type of original_content must not be null or empty.");

                int i = originalContentType.IndexOf(":");
                if (i >= 0)
                {
                    originalContentType = originalContentType.Substring(i + 1);
                }

                if (originalContentType == "DV_MULTIMEDIA")
                {
                    this.originalContent = new DvMultimedia();
                }
                else if (originalContentType == "DV_PARSABLE")
                {
                    this.originalContent = new DvParsable();
                }
                else
                {
                    throw new InvalidOperationException("originalContent type must be either DV_MULTIMEDIA or " +
                                                        "DV_PARSABLE (type: " + originalContentType + ")");
                }

                this.originalContent.ReadXml(reader);
            }

            Check.Assert(reader.LocalName == "originating_system_audit",
                         "Expected LocalName is 'originating_system_audit', but it is " + reader.LocalName);
            this.originatingSystemAudit = new FeederAuditDetails();
            this.originatingSystemAudit.ReadXml(reader);

            if (reader.LocalName == "feeder_system_audit")
            {
                this.feederSystemAudit = new FeederAuditDetails();
                this.feederSystemAudit.ReadXml(reader);
            }

            if (!reader.IsStartElement())
            {
                reader.ReadEndElement();
            }

            reader.MoveToContent();
        }
 public CMultipleAttribute(string rmAttributeName, AssumedTypes.Interval <int> existence, Cardinality cardinality,
                           AssumedTypes.List <CObject> children)
     : base(rmAttributeName, existence, children)
 {
     this.Cardinality = cardinality;
 }
Beispiel #56
0
        protected virtual void ReadXmlBase(System.Xml.XmlReader reader)
        {
            Check.Assert(reader.LocalName == "name", "Expected LocalName is 'name' rather than " + reader.LocalName);

            // %HYYKA%
            // CM: 12/11/09 need to take into account prefix
            //string nameType = reader.GetAttribute("type", XmlSerializer.XsiNamespace);
            string nameType = RmXmlSerializer.ReadXsiType(reader);

            if (nameType != null && nameType == "DV_CODED_TEXT")
            {
                this.name = new DvCodedText();
            }
            else
            {
                this.name = new DvText();
            }
            this.name.ReadXml(reader);

            if (reader.LocalName == "uid")
            {
                string uidType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                int    i       = uidType.IndexOf(":");
                if (i > 0)
                {
                    uidType = uidType.Substring(i + 1);
                }
                if (uidType == "OBJECT_VERSION_ID")
                {
                    this.uid = new ObjectVersionId();
                }
                else if (uidType == "HIER_OBJECT_ID")
                {
                    this.uid = new HierObjectId();
                }

                this.uid.ReadXml(reader);
            }
            if (reader.LocalName == "links")
            {
                this.links = new OpenEhr.AssumedTypes.List <Link>();
                do
                {
                    Link aLink = new Link();
                    aLink.ReadXml(reader);
                    this.links.Add(aLink);
                } while (reader.LocalName == "links" && reader.NodeType == System.Xml.XmlNodeType.Element);
            }

            if (reader.LocalName == "archetype_details")
            {
                this.archetypeDetails = new Archetyped();
                this.archetypeDetails.ReadXml(reader);
            }

            if (reader.LocalName == "feeder_audit")
            {
                this.feederAudit = new FeederAudit();
                this.feederAudit.ReadXml(reader);
            }
        }
Beispiel #57
0
        protected void SetBaseData(string value, OpenEhr.RM.DataTypes.Uri.DvUri hyperlink, string formatting,
            List<TermMapping> mappings, CodePhrase language, CodePhrase encoding)
        {
            this.value = value;
            this.hyperlink = hyperlink;
            this.formatting = formatting;

            if (mappings != null && mappings.Count > 0)
            {
                if (this.mappings == null)
                    this.mappings = new OpenEhr.AssumedTypes.List<TermMapping>();
                foreach (TermMapping mapping in mappings)
                {
                    this.mappings.Add(mapping);
                }
            }
            this.language = language;
            this.encoding = encoding;
        }
Beispiel #58
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.LocalName == "attested_view")
            {
                this.attestedView = new OpenEhr.RM.DataTypes.Encapsulated.DvMultimedia();
                this.attestedView.ReadXml(reader);
            }

            if (reader.LocalName == "proof")
            {
                this.proof = reader.ReadElementString("proof", RmXmlSerializer.OpenEhrNamespace);
                reader.MoveToContent();
            }

            if (reader.LocalName == "items")
            {
                this.items = new OpenEhr.AssumedTypes.List<OpenEhr.RM.DataTypes.Uri.DvEhrUri>();
                do
                {
                    DataTypes.Uri.DvEhrUri uri = new OpenEhr.RM.DataTypes.Uri.DvEhrUri();
                    uri.ReadXml(reader);

                    this.items.Add(uri);
                } while (reader.LocalName == "items");
            }

            if (reader.LocalName != "reason")
                throw new ValidationException("Excepted element name is reason, but it is: " + reader.LocalName);
            string reasonType = RmXmlSerializer.ReadXsiType(reader);
            if (!string.IsNullOrEmpty(reasonType))
            {
                this.reason = RmFactory.DataValue(reasonType) as DataTypes.Text.DvText;
            }
            else
                this.reason = new OpenEhr.RM.DataTypes.Text.DvText();
            this.reason.ReadXml(reader);

            if (reader.LocalName != "is_pending")
                throw new ValidationException("Excepted element name is is_pending, but it is: " + reader.LocalName);
            this.isPending = reader.ReadElementContentAsBoolean("is_pending", RmXmlSerializer.OpenEhrNamespace);
            reader.MoveToContent();
        }
Beispiel #59
0
        /// <summary>
        /// Total list of languages available in this resource, derived from original_language and
        /// translations.
        /// </summary>
        public AssumedTypes.List<string> LanguagesAvailable()
        {
            if (this.languagesAvailable != null && this.languagesAvailable.Count >0)
                return this.languagesAvailable;

            this.languagesAvailable = new OpenEhr.AssumedTypes.List<string>();
            this.languagesAvailable.Add(this.OriginalLanguage.CodeString);

            if (this.Translations != null)
            {
                foreach (string language in this.Translations.Keys)
                    this.languagesAvailable.Add(language);
            }

            DesignByContract.Check.Ensure(this.languagesAvailable.Count >0, "Must have at least one available language");
            DesignByContract.Check.Ensure(this.languagesAvailable.Has(this.OriginalLanguage.CodeString),
                "AuthoredResource available language(s) must contrain original language");

            return this.languagesAvailable;
        }
Beispiel #60
0
        protected virtual void ReadXmlBase(System.Xml.XmlReader reader)
        {
            Check.Assert(reader.LocalName == "name", "Expected LocalName is 'name' rather than " + reader.LocalName);

            // %HYYKA%
            // CM: 12/11/09 need to take into account prefix
            //string nameType = reader.GetAttribute("type", XmlSerializer.XsiNamespace);
            string nameType = RmXmlSerializer.ReadXsiType(reader);
            if (nameType != null && nameType == "DV_CODED_TEXT")
                this.name = new DvCodedText();
            else
                this.name = new DvText();
            this.name.ReadXml(reader);

            if (reader.LocalName == "uid")
            {
                string uidType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                int i = uidType.IndexOf(":");
                if (i > 0)
                    uidType = uidType.Substring(i + 1);
                if (uidType == "OBJECT_VERSION_ID")
                    this.uid = new ObjectVersionId();
                else if (uidType == "HIER_OBJECT_ID")
                    this.uid = new HierObjectId();

                this.uid.ReadXml(reader);
            }
            if (reader.LocalName == "links")
            {
                this.links = new OpenEhr.AssumedTypes.List<Link>();
                do
                {
                    Link aLink = new Link();
                    aLink.ReadXml(reader);
                    this.links.Add(aLink);
                } while (reader.LocalName == "links" && reader.NodeType == System.Xml.XmlNodeType.Element);
            }

            if (reader.LocalName == "archetype_details")
            {
                this.archetypeDetails = new Archetyped();
                this.archetypeDetails.ReadXml(reader);
            }

            if (reader.LocalName == "feeder_audit")
            {
                this.feederAudit = new FeederAudit();
                this.feederAudit.ReadXml(reader);
            }
        }