public TransportRule Initialize(IConfigDataProvider dataSession, DataClassificationIdParameter identity, OptionalIdentityData optionalData) { ArgumentValidator.ThrowIfNull("dataSession", dataSession); ArgumentValidator.ThrowIfNull("identity", identity); identity.ShouldIncludeOutOfBoxCollections = false; this.task.WriteVerbose(TaskVerboseStringHelper.GetFindByIdParameterVerboseString(identity, dataSession, typeof(TransportRule), null)); IEnumerable <TransportRule> enumerable = null; try { LocalizedString?localizedString; enumerable = identity.GetObjects <TransportRule>(null, dataSession, optionalData, out localizedString); } finally { this.task.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(dataSession)); } string[] array = new string[] { identity.DataClassificationIdentity }; List <QueryMatchResult> list = new List <QueryMatchResult>(); foreach (TransportRule transportRule in enumerable) { XDocument rulePackXDoc; if (this.TryParseADRulePack(transportRule, out rulePackXDoc) && XmlProcessingUtils.IsFingerprintRuleCollection(rulePackXDoc)) { List <QueryMatchResult> list2 = XmlProcessingUtils.GetMatchingRulesById(rulePackXDoc, array).ToList <QueryMatchResult>(); if (list2.Count == 0) { list2 = XmlProcessingUtils.GetMatchingRulesByName(rulePackXDoc, array, NameMatchingOptions.InvariantNameOrLocalizedNameMatch, true).ToList <QueryMatchResult>(); } list.AddRange(list2); if (list.Count == 1) { this.adRulePack = transportRule; this.ruleXElement = list[0].MatchingRuleXElement; this.ruleResourceXElement = list[0].MatchingResourceXElement; this.rulePackXDocument = this.ruleXElement.Document; ClassificationRuleCollectionPresentationObject rulePackPresentationObject = ClassificationRuleCollectionPresentationObject.Create(this.adRulePack, this.rulePackXDocument); this.DataClassificationPresentationObject = DataClassificationPresentationObject.Create(list[0].MatchingRuleId, list[0].MatchingRuleXElement, list[0].MatchingResourceXElement, rulePackPresentationObject); } else if (list.Count > 1) { break; } } } if (list.Count <= 0) { throw new ManagementObjectNotFoundException(Strings.ErrorCannotFindFingerprintDataClassification(identity.ToString())); } if (list.Count > 1) { throw new ManagementObjectAmbiguousException(Strings.ErrorManagementObjectAmbiguous(identity.ToString())); } return(this.adRulePack); }
public new static DataClassificationIdParameter Parse(string identity) { DataClassificationIdParameter dataClassificationIdParameter = new DataClassificationIdParameter(identity); return(new DataClassificationIdParameter(dataClassificationIdParameter.IsHierarchical ? ClassificationDefinitionUtils.CreateHierarchicalIdentityString(dataClassificationIdParameter.OrganizationName, "*") : "*", dataClassificationIdParameter.FriendlyName)); }