Ejemplo n.º 1
0
 private QueryFilter TryParseFilter(IConfigSchema schema, QueryParser.EvaluateVariableDelegate evalDelegate, out Exception ex)
 {
     ex = null;
     if (this.parsedFilter == null)
     {
         if (!this.HasExplicitScopeFilter)
         {
             if (this.Scopes == null || this.Scopes.Count == 0)
             {
                 this.parsedFilter = QueryFilter.True;
             }
             else
             {
                 List <QueryFilter> list = new List <QueryFilter>(1);
                 foreach (SettingsScope settingsScope in this.Scopes)
                 {
                     list.Add(settingsScope.ConstructScopeFilter(schema));
                 }
                 this.parsedFilter = (QueryFilter.AndTogether(list.ToArray()) ?? QueryFilter.False);
             }
         }
         else if (string.IsNullOrWhiteSpace(this.ScopeFilter))
         {
             this.parsedFilter = QueryFilter.True;
             this.scopeFilter  = null;
         }
         else
         {
             try
             {
                 SettingsScopeFilterSchema scopeFilterSchema = SettingsScopeFilterSchema.GetSchemaInstance(schema);
                 QueryParser queryParser = new QueryParser(this.ScopeFilter, QueryParser.Capabilities.All, new QueryParser.LookupPropertyDelegate(scopeFilterSchema.LookupSchemaProperty), () => scopeFilterSchema.AllFilterableProperties, evalDelegate, new QueryParser.ConvertValueFromStringDelegate(MailboxProvisioningConstraint.ConvertValueFromString));
                 this.parsedFilter = queryParser.ParseTree;
             }
             catch (InvalidCastException ex2)
             {
                 ex = ex2;
             }
             catch (ParsingException ex3)
             {
                 ex = ex3;
             }
             catch (ArgumentOutOfRangeException ex4)
             {
                 ex = ex4;
             }
             if (ex != null)
             {
                 ex = new ConfigurationSettingsInvalidScopeFilter(ex.Message, ex);
                 this.parsedFilter = QueryFilter.False;
             }
             else
             {
                 this.scopeFilter = this.parsedFilter.GenerateInfixString(FilterLanguage.Monad);
             }
         }
     }
     return(this.parsedFilter);
 }
Ejemplo n.º 2
0
 internal override QueryFilter ConstructScopeFilter(IConfigSchema schema)
 {
     if (!string.IsNullOrEmpty(base.Restriction.SubType))
     {
         SettingsScopeFilterSchema schemaInstance     = SettingsScopeFilterSchema.GetSchemaInstance(schema);
         PropertyDefinition        propertyDefinition = schemaInstance.LookupSchemaProperty(base.Restriction.SubType);
         if (propertyDefinition != null)
         {
             return(new TextFilter(propertyDefinition, base.Restriction.NameMatch, MatchOptions.WildcardString, MatchFlags.IgnoreCase));
         }
     }
     return(QueryFilter.False);
 }