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; }
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); } }