Esempio n. 1
0
        /// <summary>
        /// Checks the property passed in as a parement to see
        /// if the property value matches the format of either
        /// Uniclass, NBS or NRM.
        /// </summary>
        /// <param name="property">A string value of the assets property</param>
        /// <returns>An InferredClassification which contains the classification mappings</returns>
        static private IEnumerable <InferredClassification> FindInferredClassifications(string property, ClassificationMappingReader dataReader)
        {
            //Check to see if the property is a valid classification
            Pointer match = null;
            var     classificationMatches = Regex.Match(property, RegexPatterns.UniclassPattern);

            if (classificationMatches.Success)
            {
                match = dataReader.GetMatchingPointer(classificationMatches.Value); //Get Uniclass matches from the Mappings Table
            }
            else
            {
                classificationMatches = Regex.Match(property, RegexPatterns.NbsPattern);
                if (classificationMatches.Success)
                {
                    match = dataReader.GetMatchingPointer(classificationMatches.Value);
                }
                else
                {
                    classificationMatches = Regex.Match(property, RegexPatterns.NrmPattern);
                    if (classificationMatches.Success)
                    {
                        match = dataReader.GetMatchingPointer(classificationMatches.Value);
                    }
                }
            }
            //Get Mappings that match the InferredClassification
            if (match != null)
            {
                return(dataReader.GetInferredMapping(match));
            }
            else
            {
                return(Enumerable.Empty <InferredClassification>());
            }
        }