private Dictionary <Workload, List <ChangeNotificationData> > GenerateSyncsForFailedBindings() { Dictionary <Workload, List <ChangeNotificationData> > dictionary = new Dictionary <Workload, List <ChangeNotificationData> >(); using (IEnumerator <BindingStorage> enumerator = this.PsPolicyPresentationObject.StorageBindings.GetEnumerator()) { while (enumerator.MoveNext()) { BindingStorage bindingStorage = enumerator.Current; IEnumerable <UnifiedPolicySettingStatus> source = PolicySettingStatusHelpers.LoadSyncStatuses(base.DataSession, Utils.GetUniversalIdentity(bindingStorage), typeof(BindingStorage).Name); bool flag = false; if (source.Any((UnifiedPolicySettingStatus s) => SetCompliancePolicyBase.HasDistributionFailed(bindingStorage, s))) { flag = true; bindingStorage.PolicyVersion = CombGuidGenerator.NewGuid(); if (!dictionary.ContainsKey(bindingStorage.Workload)) { dictionary[bindingStorage.Workload] = new List <ChangeNotificationData>(); } dictionary[bindingStorage.Workload].Add(AggregatedNotificationClients.CreateChangeData(bindingStorage.Workload, bindingStorage)); } List <ChangeNotificationData> list = this.GenerateSyncsForFailedScopes(bindingStorage.AppliedScopes); list.AddRange(this.GenerateSyncsForFailedScopes(bindingStorage.RemovedScopes)); if (list.Any <ChangeNotificationData>()) { if (!dictionary.ContainsKey(bindingStorage.Workload)) { dictionary[bindingStorage.Workload] = new List <ChangeNotificationData>(); } dictionary[bindingStorage.Workload].AddRange(list); if (!flag) { flag = true; bindingStorage.PolicyVersion = CombGuidGenerator.NewGuid(); base.DataSession.Save(bindingStorage); dictionary[bindingStorage.Workload].Add(AggregatedNotificationClients.CreateChangeData(bindingStorage.Workload, bindingStorage)); } } if (flag) { base.DataSession.Save(bindingStorage); } } } return(dictionary); }
private static Dictionary <Workload, List <ChangeNotificationData> > GenerateSyncs(IEnumerable <UnifiedPolicySettingStatus> syncStatuses, IEnumerable <Workload> workloads, IConfigDataProvider dataSession, UnifiedPolicyStorageBase storageObject, ConfigurationObjectType objectType) { Dictionary <Workload, List <ChangeNotificationData> > dictionary = new Dictionary <Workload, List <ChangeNotificationData> >(); if (syncStatuses.Any((UnifiedPolicySettingStatus s) => SetCompliancePolicyBase.HasDistributionFailed(storageObject, s))) { storageObject.PolicyVersion = CombGuidGenerator.NewGuid(); dataSession.Save(storageObject); foreach (Workload workload in workloads) { dictionary[workload] = new List <ChangeNotificationData> { AggregatedNotificationClients.CreateChangeData(workload, storageObject) }; } } return(dictionary); }
private List <ChangeNotificationData> GenerateSyncsForFailedScopes(IEnumerable <ScopeStorage> scopeStorages) { List <ChangeNotificationData> list = new List <ChangeNotificationData>(); foreach (ScopeStorage scopeStorage in scopeStorages) { IEnumerable <UnifiedPolicySettingStatus> enumerable = PolicySettingStatusHelpers.LoadSyncStatuses(base.DataSession, Utils.GetUniversalIdentity(scopeStorage), typeof(ScopeStorage).Name); foreach (UnifiedPolicySettingStatus status in enumerable) { if (SetCompliancePolicyBase.HasDistributionFailed(scopeStorage, status)) { scopeStorage.PolicyVersion = CombGuidGenerator.NewGuid(); list.Add(AggregatedNotificationClients.CreateChangeData(scopeStorage.Workload, scopeStorage)); } } } return(list); }