internal static DataClassificationPresentationObject Create(string ruleIdentifier, DataClassificationLocalizableDetails defaultRuleDetails, XElement ruleElement, XElement resourceElement, ClassificationRuleCollectionPresentationObject rulePackPresentationObject) { ArgumentValidator.ThrowIfNullOrEmpty("ruleIdentifier", ruleIdentifier); ArgumentValidator.ThrowIfNull("defaultRuleDetails", defaultRuleDetails); ArgumentValidator.ThrowIfNull("ruleElement", ruleElement); ArgumentValidator.ThrowIfNull("resourceElement", resourceElement); ArgumentValidator.ThrowIfNull("rulePackPresentationObject", rulePackPresentationObject); MultiValuedProperty <Fingerprint> multiValuedProperty = null; if (rulePackPresentationObject.IsFingerprintRuleCollection && ruleElement.Document != null) { multiValuedProperty = XmlProcessingUtils.ReadAllReferredFingerprints(ruleElement); } return(new DataClassificationPresentationObject { defaultDetails = defaultRuleDetails, localizedNames = XmlProcessingUtils.ReadAllRuleNames(resourceElement), localizedDescriptions = XmlProcessingUtils.ReadAllRuleDescriptions(resourceElement), fingerprints = multiValuedProperty, Identity = DataClassificationPresentationObject.CreateDataClassificationIdentifier(ruleIdentifier, rulePackPresentationObject), ClassificationType = (rulePackPresentationObject.IsFingerprintRuleCollection ? ClassificationTypeEnum.Fingerprint : DataClassificationPresentationObject.Parse(ruleElement.Name.LocalName)), ClassificationRuleCollection = rulePackPresentationObject, RecommendedConfidence = XmlProcessingUtils.ReadRuleRecommendedConfidence(ruleElement), MinEngineVersion = XmlProcessingUtils.GetRulePackElementVersion(ruleElement) }); }
internal static IEnumerable <KeyValuePair <string, ExchangeBuild> > GetTextProcessorReferences(XElement rulePackElement, ISet <string> matchElementNames) { if (rulePackElement == null) { throw new ArgumentNullException("rulePackElement"); } if (matchElementNames == null) { throw new ArgumentNullException("matchElementNames"); } return(from rulePackChildElement in rulePackElement.Descendants().AsParallel <XElement>() where matchElementNames.Contains(rulePackChildElement.Name.LocalName) let textProcessorId = rulePackChildElement.Attribute("idRef").Value let version = XmlProcessingUtils.GetRulePackElementVersion(rulePackChildElement) select new KeyValuePair <string, ExchangeBuild>(textProcessorId, version)); }