Пример #1
0
        public SearchWorkDefinition ParseSearch(ComplianceMessage target, SearchWorkDefinition definition)
        {
            QueryFilter     queryFilter = null;
            string          query       = definition.Query;
            CultureInfo     culture;
            FaultDefinition faultDefinition;

            ExceptionHandler.Parser.TryRun(delegate
            {
                if (string.IsNullOrEmpty(target.Culture))
                {
                    culture = CultureInfo.InvariantCulture;
                }
                else
                {
                    culture = CultureInfo.GetCultureInfo(target.Culture);
                }
                Func <IRecipientResolver, IPolicyTagProvider, QueryFilter> func = null;
                switch (definition.Parser)
                {
                case SearchWorkDefinition.QueryParser.KQL:
                    func = ((IRecipientResolver r, IPolicyTagProvider p) => KqlParser.ParseAndBuildQuery(query, KqlParser.ParseOption.EDiscoveryMode, culture, r, p));
                    break;

                case SearchWorkDefinition.QueryParser.AQS:
                    func = delegate(IRecipientResolver r, IPolicyTagProvider p)
                    {
                        AqsParser.ParseOption parseOption = AqsParser.ParseOption.UseCiKeywordOnly | AqsParser.ParseOption.DisablePrefixMatch | AqsParser.ParseOption.AllowShortWildcards;
                        return(AqsParser.ParseAndBuildQuery(query, parseOption, culture, r, p));
                    };
                    break;
                }
                if (func != null)
                {
                    OrganizationId scopingOrganizationId = null;
                    IPolicyTagProvider arg  = null;
                    IRecipientResolver arg2 = null;
                    if (OrganizationId.TryCreateFromBytes(target.TenantId, Encoding.UTF8, out scopingOrganizationId))
                    {
                        ADSessionSettings adsessionSettings               = ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(scopingOrganizationId);
                        adsessionSettings.IncludeInactiveMailbox          = true;
                        IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.PartiallyConsistent, adsessionSettings, 146, "ParseSearch", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\ApplicationPlugins\\EDiscovery\\FastLocalSearchResultsProvider.cs");
                        arg2 = new FastLocalSearchResultsProvider.RecipientIdentityResolver(tenantOrRootOrgRecipientSession);
                        IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, adsessionSettings, 149, "ParseSearch", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\ApplicationPlugins\\EDiscovery\\FastLocalSearchResultsProvider.cs");
                        arg = new PolicyTagAdProvider(tenantOrTopologyConfigurationSession);
                    }
                    queryFilter = func(arg2, arg);
                }
                if (queryFilter != null)
                {
                    definition.Query = FqlQueryBuilder.ToFqlString(queryFilter, culture);
                }
            }, TimeSpan.FromMinutes(1.0), out faultDefinition, target, null, default(CancellationToken), null, "ParseSearch", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\ApplicationPlugins\\EDiscovery\\FastLocalSearchResultsProvider.cs", 102);
            if (faultDefinition != null)
            {
                ExceptionHandler.FaultMessage(target, faultDefinition, true);
            }
            return(definition);
        }
Пример #2
0
 public NotifyByEmailAutomationActionProvider(
     IAutomationContextProvider automationContextProvider,
     IRecipientResolver recipientResolver,
     ITemplateRenderer templateRenderer,
     IEmailSender emailSender)
 {
     _automationContextProvider = automationContextProvider;
     _recipientResolver         = recipientResolver;
     _templateRenderer          = templateRenderer;
     _emailSender = emailSender;
 }
Пример #3
0
        public void PackageDeliveryToServer(ipp_Package package)
        {
            IRecipientResolver resolver = GetService <IRecipientResolver>();
            var ret = resolver.ParseRecipients(package.PR);

            if (!ret.Ret)
            {
                return;
            }

            IPackageDealer dealer     = new PackageDealer();
            var            refpackage = dealer.SavePackage(package);
            var            receivers  = ret.Obj as string[];
            var            count      = dealer.DealPackage(refpackage, receivers);
            //return Result(count > 0, receivers.Length == count ? "" : (receivers.Length - count) + "个用户未能派送包裹");
        }
Пример #4
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);
        }
Пример #5
0
 public static QueryFilter ParseAndBuildQuery(string query, KqlParser.ParseOption parseOption, CultureInfo cultureInfo, IRecipientResolver recipientResolver, IPolicyTagProvider policyTagProvider)
 {
     return(KqlParser.ParseAndBuildQuery(query, parseOption, cultureInfo, RescopedAll.Default, recipientResolver, policyTagProvider));
 }
Пример #6
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;
 }
Пример #7
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);
        }