Exemplo n.º 1
0
 public QueryFilterBuilder(LocalizedKeywordMapping keywordMapping, KqlParser.ParseOption parseOptions, RescopedAll rescopedAll, IRecipientResolver recipientResolver, IPolicyTagProvider policyTagProvider, CultureInfo culture)
 {
     this.culture           = culture;
     this.parseOptions      = parseOptions;
     this.AllowedKeywords   = PropertyKeywordHelper.AllPropertyKeywords;
     this.keywordMapping    = keywordMapping;
     this.recipientResolver = recipientResolver;
     this.policyTagProvider = policyTagProvider;
     this.rescopedAll       = rescopedAll;
 }
Exemplo n.º 2
0
        public static QueryFilter ParseAndBuildQuery(string query, KqlParser.ParseOption parseOption, CultureInfo cultureInfo, RescopedAll rescopedAll, IRecipientResolver recipientResolver, IPolicyTagProvider policyTagProvider)
        {
            KqlParser kqlParser                   = new KqlParser();
            LocalizedKeywordMapping mapping       = LocalizedKeywordMapping.GetMapping(cultureInfo);
            TreeNode           treeNode           = kqlParser.Parse(query, parseOption, cultureInfo, mapping);
            QueryFilterBuilder queryFilterBuilder = new QueryFilterBuilder(mapping, parseOption, rescopedAll, recipientResolver, policyTagProvider, cultureInfo);

            queryFilterBuilder.AllowedKeywords = KqlParser.GetSupportedProperties(parseOption);
            QueryFilter queryFilter = queryFilterBuilder.Build(treeNode);

            if (queryFilter == null)
            {
                if ((parseOption & KqlParser.ParseOption.SuppressError) == KqlParser.ParseOption.None)
                {
                    throw new ParserException(new ParserErrorInfo(ParserErrorCode.ParserError));
                }
                queryFilter = queryFilterBuilder.BuildAllFilter(query);
            }
            return(queryFilter);
        }
Exemplo n.º 3
0
        public static QueryFilter ParseAndBuildQuery(string query, AqsParser.ParseOption parseOption, CultureInfo culture, RescopedAll rescopedAll, IRecipientResolver recipientResolver, IPolicyTagProvider policyTagProvider)
        {
            AqsParser   aqsParser   = new AqsParser();
            QueryFilter queryFilter = null;

            using (Condition condition = aqsParser.Parse(query, parseOption, culture))
            {
                QueryFilterBuilder queryFilterBuilder = new QueryFilterBuilder(culture, parseOption);
                queryFilterBuilder.RescopedAll       = rescopedAll;
                queryFilterBuilder.RecipientResolver = recipientResolver;
                queryFilterBuilder.PolicyTagProvider = policyTagProvider;
                queryFilterBuilder.AllowedKeywords   = aqsParser.AllowedKeywords;
                if (condition != null)
                {
                    queryFilter = queryFilterBuilder.Build(condition);
                }
                if (queryFilter == null)
                {
                    if (!aqsParser.SuppressError)
                    {
                        throw new ParserException(new ParserErrorInfo(ParserErrorCode.ParserError));
                    }
                    queryFilter = queryFilterBuilder.BuildAllFilter(1, query);
                }
            }
            return(queryFilter);
        }