コード例 #1
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (RecipientFilterHelper.FixExchange12RecipientFilterMetadata(this.DataObject, ADObjectSchema.ExchangeVersion, ADDynamicGroupSchema.PurportedSearchUI, ADDynamicGroupSchema.RecipientFilterMetadata, string.Empty))
     {
         base.WriteVerbose(Strings.WarningFixTheInvalidRecipientFilterMetadata(this.Identity.ToString()));
     }
     if (!base.IsUpgrading || this.ForceUpgrade || base.ShouldContinue(Strings.ContinueUpgradeObjectVersion(this.DataObject.Name)))
     {
         base.InternalProcessRecord();
     }
     TaskLogger.LogExit();
 }
コード例 #2
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            if (RecipientFilterHelper.FixExchange12RecipientFilterMetadata(this.DataObject, ADObjectSchema.ExchangeVersion, EmailAddressPolicySchema.PurportedSearchUI, EmailAddressPolicySchema.RecipientFilterMetadata, this.DataObject.LdapRecipientFilter))
            {
                base.WriteVerbose(Strings.WarningFixTheInvalidRecipientFilterMetadata(this.Identity.ToString()));
            }
            bool flag = this.affectedPolicies != null && this.affectedPolicies.Length > 0;
            List <EmailAddressPolicy> list = new List <EmailAddressPolicy>();

            try
            {
                if (!base.IsUpgrading || this.ForceUpgrade || base.ShouldContinue(Strings.ContinueUpgradeObjectVersion(this.DataObject.Name)))
                {
                    if (this.DataObject.IsChanged(EmailAddressPolicySchema.Priority))
                    {
                        for (int i = 0; i < this.affectedPolicies.Length; i++)
                        {
                            if (flag)
                            {
                                base.WriteProgress(Strings.ProgressEmailAddressPolicyPreparingPriority, Strings.ProgressEmailAddressPolicyAdjustingPriority(this.affectedPolicies[i].Identity.ToString()), i * 99 / this.affectedPolicies.Length + 1);
                            }
                            bool recipientFilterApplied = this.affectedPolicies[i].RecipientFilterApplied;
                            if (!this.affectedPolicies[i].ExchangeVersion.IsOlderThan(EmailAddressPolicySchema.RecipientFilterApplied.VersionAdded))
                            {
                                this.affectedPolicies[i][EmailAddressPolicySchema.RecipientFilterApplied] = false;
                            }
                            base.DataSession.Save(this.affectedPolicies[i]);
                            if (!this.affectedPolicies[i].ExchangeVersion.IsOlderThan(EmailAddressPolicySchema.RecipientFilterApplied.VersionAdded))
                            {
                                this.affectedPolicies[i][EmailAddressPolicySchema.RecipientFilterApplied] = recipientFilterApplied;
                            }
                            this.affectedPolicies[i].Priority = this.affectedPoliciesOriginalPriority[i];
                            list.Add(this.affectedPolicies[i]);
                        }
                    }
                    base.InternalProcessRecord();
                    if (!base.HasErrors)
                    {
                        list.Clear();
                    }
                }
            }
            finally
            {
                for (int j = 0; j < list.Count; j++)
                {
                    EmailAddressPolicy emailAddressPolicy = list[j];
                    try
                    {
                        if (flag)
                        {
                            base.WriteProgress(Strings.ProgressEmailAddressPolicyPreparingPriority, Strings.ProgressEmailAddressPolicyRollingBackPriority(emailAddressPolicy.Identity.ToString()), j * 99 / list.Count + 1);
                        }
                        base.DataSession.Save(emailAddressPolicy);
                    }
                    catch (DataSourceTransientException)
                    {
                        this.WriteWarning(Strings.VerboseFailedToRollbackPriority(emailAddressPolicy.Id.ToString()));
                    }
                }
            }
            TaskLogger.LogExit();
        }