private static TransportRule GetTransportRuleUnParsed(IConfigDataProvider dataSession, string collectionName, QueryFilter filter) { ADRuleStorageManager adruleStorageManager = new ADRuleStorageManager(collectionName, dataSession); adruleStorageManager.LoadRuleCollectionWithoutParsing(filter); TransportRule result = null; if (adruleStorageManager.Count > 0) { adruleStorageManager.GetRuleWithoutParsing(0, out result); } return(result); }
private TransportRule GetTransportRule(string ruleName) { ADRuleStorageManager adruleStorageManager = new ADRuleStorageManager("HostedContentFilterVersioned", base.DataSession); adruleStorageManager.LoadRuleCollectionWithoutParsing(new TextFilter(ADObjectSchema.Name, ruleName, MatchOptions.FullString, MatchFlags.Default)); TransportRule result = null; if (adruleStorageManager.Count > 0) { adruleStorageManager.GetRuleWithoutParsing(0, out result); } return(result); }
protected override void WriteResult <T>(IEnumerable <T> dataObjects) { try { if (this.Identity == null) { ADRuleStorageManager adruleStorageManager = new ADRuleStorageManager(this.ruleCollectionName, base.DataSession); adruleStorageManager.LoadRuleCollectionWithoutParsing(); for (int i = 0; i < adruleStorageManager.Count; i++) { TransportRule transportRule; adruleStorageManager.GetRuleWithoutParsing(i, out transportRule); this.OutputRule(i, transportRule); } } else { List <TransportRule> list = new List <TransportRule>(); list.AddRange((IEnumerable <TransportRule>)dataObjects); Dictionary <OrganizationId, ADRuleStorageManager> ruleCollections = this.GetRuleCollections(list); foreach (KeyValuePair <OrganizationId, ADRuleStorageManager> keyValuePair in ruleCollections) { for (int j = 0; j < keyValuePair.Value.Count; j++) { TransportRule transportRule; keyValuePair.Value.GetRuleWithoutParsing(j, out transportRule); if (Utils.IsRuleIdInList(transportRule.Id, list)) { this.OutputRule(j, transportRule); } } } } } catch (RuleCollectionNotInAdException) { } }