示例#1
0
        protected AuthoredResource(CodePhrase originalLanguage, Generic.RevisionHistory revisionHistory,
            bool isControlled)
        {
            DesignByContract.Check.Require(originalLanguage!= null, "originalLanguage must not be null.");
            DesignByContract.Check.Require(!isControlled ^ revisionHistory != null, "RevisionHistory is only required if isControlled is true");

            this.originalLanguage = originalLanguage;
            this.IsControlled = isControlled;
            this.revisionHistory = revisionHistory;
        }
示例#2
0
        protected AuthoredResource(CodePhrase originalLanguage, Generic.RevisionHistory revisionHistory,
                                   bool isControlled)
        {
            DesignByContract.Check.Require(originalLanguage != null, "originalLanguage must not be null.");
            DesignByContract.Check.Require(!isControlled ^ revisionHistory != null, "RevisionHistory is only required if isControlled is true");

            this.originalLanguage = originalLanguage;
            this.IsControlled     = isControlled;
            this.revisionHistory  = revisionHistory;
        }
示例#3
0
        protected AuthoredResource(CodePhrase originalLanguage, AssumedTypes.Hash <TranslationDetails, string> translations,
                                   ResourceDescription description, Generic.RevisionHistory revisionHistory, bool isControlled) :
            this(originalLanguage, revisionHistory, isControlled)
        {
            DesignByContract.Check.Require(translations == null ^
                                           (translations.Keys.Count > 0 && !translations.HasKey(this.originalLanguage.CodeString)),
                                           "translations is not null means it must not be empty and it must not contains original language.");
            DesignByContract.Check.Require(translations == null ^ (description != null && translations != null),
                                           "if translations !=null, descriptions must not be null");


            this.translations = translations;
            this.description  = description;
        }
示例#4
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            Check.Assert(reader.LocalName == "original_language", "Expected LocalName is 'original_language' rather than " + reader.LocalName);
            this.originalLanguage = new CodePhrase();
            this.OriginalLanguage.ReadXml(reader);

            if (reader.LocalName == "is_controlled")
            {
                this.IsControlled = reader.ReadElementContentAsBoolean("is_controlled", RmXmlSerializer.OpenEhrNamespace);
            }
            if (reader.LocalName == "description")
            {
                this.description = new ResourceDescription();
                this.description.ReadXml(reader);
            }

            string translationsNodeName = "translations";

            if (reader.LocalName == translationsNodeName)
            {
                System.Collections.Generic.Dictionary <string, TranslationDetails> translationDic = new Dictionary <string, TranslationDetails>();
                do
                {
                    TranslationDetails transDetails = new TranslationDetails();
                    transDetails.ReadXml(reader);

                    translationDic.Add(transDetails.Language.CodeString, transDetails);
                } while (reader.LocalName == translationsNodeName);

                if (translationDic.Count > 0)
                {
                    this.translations = new OpenEhr.AssumedTypes.Hash <TranslationDetails, string>(translationDic);
                }
            }

            if (reader.LocalName == "revision_history")
            {
                this.revisionHistory = new OpenEhr.RM.Common.Generic.RevisionHistory();
                this.revisionHistory.ReadXml(reader);
            }
        }
示例#5
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            Check.Assert(reader.LocalName == "original_language", "Expected LocalName is 'original_language' rather than " + reader.LocalName);
            this.originalLanguage = new CodePhrase();
            this.OriginalLanguage.ReadXml(reader);

            if (reader.LocalName == "is_controlled")
            {
                this.IsControlled = reader.ReadElementContentAsBoolean("is_controlled", RmXmlSerializer.OpenEhrNamespace);

            }
            if (reader.LocalName == "description")
            {
                this.description = new ResourceDescription();
                this.description.ReadXml(reader);
            }

            string translationsNodeName = "translations";
            if (reader.LocalName == translationsNodeName)
            {
                System.Collections.Generic.Dictionary<string, TranslationDetails> translationDic = new Dictionary<string, TranslationDetails>();
                do
                {
                    TranslationDetails transDetails = new TranslationDetails();
                    transDetails.ReadXml(reader);

                    translationDic.Add(transDetails.Language.CodeString, transDetails);
                } while (reader.LocalName == translationsNodeName);

                if (translationDic.Count > 0)
                    this.translations = new OpenEhr.AssumedTypes.Hash<TranslationDetails, string>(translationDic);
            }

            if (reader.LocalName == "revision_history")
            {
                this.revisionHistory = new OpenEhr.RM.Common.Generic.RevisionHistory();
                this.revisionHistory.ReadXml(reader);
            }
        }