protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     UpgradeBucketTaskHelper.ValidateSourceAndTargetVersions(this.DataObject.SourceVersion, this.DataObject.TargetVersion, new Task.ErrorLoggerDelegate(base.WriteError));
     TaskLogger.LogExit();
 }
        internal static void ValidateOrganizationVersion(ExchangeConfigurationUnit configurationUnit, ExchangeUpgradeBucket exchangeUpgradeBucket, Task.ErrorLoggerDelegate errorLogger)
        {
            string text = configurationUnit.IsUpgradingOrganization ? exchangeUpgradeBucket.TargetVersion : exchangeUpgradeBucket.SourceVersion;

            if (!UpgradeBucketTaskHelper.ValidateExchangeObjectVersion(configurationUnit.AdminDisplayVersion, text))
            {
                errorLogger(new RecipientTaskException(Strings.ExchangeUpgradeBucketInvalidOrganizationVersion(configurationUnit.AdminDisplayVersion.ToString(), text)), ExchangeErrorCategory.Client, null);
            }
        }
 internal static void ValidateOrganizationAddition(ITopologyConfigurationSession configSession, OrganizationId organizationId, ExchangeUpgradeBucket exchangeUpgradeBucket, Task.ErrorLoggerDelegate errorLogger)
 {
     if (!exchangeUpgradeBucket.MaxMailboxes.IsUnlimited && !exchangeUpgradeBucket.Organizations.Contains(organizationId.ConfigurationUnit))
     {
         int mailboxCount  = UpgradeBucketTaskHelper.MailboxCountCache.GetMailboxCount(organizationId, configSession);
         int mailboxCount2 = UpgradeBucketTaskHelper.GetMailboxCount(exchangeUpgradeBucket);
         int num           = exchangeUpgradeBucket.MaxMailboxes.Value - mailboxCount2;
         if (mailboxCount > num)
         {
             errorLogger(new RecipientTaskException(Strings.ExchangeUpgradeBucketNotEnoughCapacity(exchangeUpgradeBucket.ToString(), num.ToString(), mailboxCount.ToString())), ExchangeErrorCategory.Client, organizationId);
         }
     }
 }
예제 #4
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     base.InternalValidate();
     if (this.DataObject.IsChanged(ExchangeUpgradeBucketSchema.MaxMailboxes) && !this.DataObject.MaxMailboxes.IsUnlimited && this.DataObject.Organizations.Count > 0)
     {
         int mailboxCount = UpgradeBucketTaskHelper.GetMailboxCount(this.DataObject);
         if (this.DataObject.MaxMailboxes.Value < mailboxCount)
         {
             base.WriteError(new RecipientTaskException(Strings.ExchangeUpgradeBucketInvalidCapacityValue), ExchangeErrorCategory.Client, this.DataObject);
         }
     }
     TaskLogger.LogExit();
 }
예제 #5
0
 protected override void WriteResult(IConfigurable dataObject)
 {
     TaskLogger.LogEnter(new object[]
     {
         dataObject.Identity,
         dataObject
     });
     if (this.EnableMailboxCounting)
     {
         ExchangeUpgradeBucket exchangeUpgradeBucket = (ExchangeUpgradeBucket)dataObject;
         exchangeUpgradeBucket.MailboxCount = UpgradeBucketTaskHelper.GetMailboxCount(exchangeUpgradeBucket);
     }
     base.WriteResult(dataObject);
     TaskLogger.LogExit();
 }
예제 #6
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ExchangeConfigurationUnit exchangeConfigurationUnit = (ExchangeConfigurationUnit)base.PrepareDataObject();

            if (base.Fields.IsModified(OrganizationSchema.DefaultMovePriority))
            {
                exchangeConfigurationUnit.DefaultMovePriority = this.DefaultMovePriority;
            }
            if (base.Fields.IsModified("TenantSKUCapability"))
            {
                CapabilityHelper.SetTenantSKUCapabilities(this.PersistedCapabilities, exchangeConfigurationUnit.PersistedCapabilities);
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeMessage))
            {
                exchangeConfigurationUnit.UpgradeMessage = this.UpgradeMessage;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeDetails))
            {
                exchangeConfigurationUnit.UpgradeDetails = this.UpgradeDetails;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeConstraints))
            {
                exchangeConfigurationUnit.UpgradeConstraints = this.UpgradeConstraints;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeStage))
            {
                exchangeConfigurationUnit.UpgradeStage = this.UpgradeStage;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeStageTimeStamp))
            {
                exchangeConfigurationUnit.UpgradeStageTimeStamp = this.UpgradeStageTimeStamp;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeE14RequestCountForCurrentStage))
            {
                exchangeConfigurationUnit.UpgradeE14RequestCountForCurrentStage = this.UpgradeE14RequestCountForCurrentStage;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeE14MbxCountForCurrentStage))
            {
                exchangeConfigurationUnit.UpgradeE14MbxCountForCurrentStage = this.UpgradeE14MbxCountForCurrentStage;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeLastE14CountsUpdateTime))
            {
                exchangeConfigurationUnit.UpgradeLastE14CountsUpdateTime = this.UpgradeLastE14CountsUpdateTime;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeConstraintsDisabled))
            {
                exchangeConfigurationUnit.UpgradeConstraintsDisabled = this.UpgradeConstraintsDisabled;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeUnitsOverride))
            {
                exchangeConfigurationUnit.UpgradeUnitsOverride = this.UpgradeUnitsOverride;
            }
            if (base.Fields.IsModified(OrganizationSchema.MaxAddressBookPolicies))
            {
                exchangeConfigurationUnit.MaxAddressBookPolicies = new int?(this.MaxAddressBookPolicies);
            }
            if (base.Fields.IsModified(OrganizationSchema.MaxOfflineAddressBooks))
            {
                exchangeConfigurationUnit.MaxOfflineAddressBooks = new int?(this.MaxOfflineAddressBooks);
            }
            if (this.RemoveSharedConfigurations)
            {
                exchangeConfigurationUnit.SupportedSharedConfigurations.Clear();
            }
            if (base.Fields.IsModified(OrganizationSchema.SupportedSharedConfigurations))
            {
                if (this.ClearPreviousSharedConfigurations)
                {
                    exchangeConfigurationUnit.SupportedSharedConfigurations.Clear();
                }
                foreach (ExchangeConfigurationUnit exchangeConfigurationUnit2 in this.SharedConfigurationUnits)
                {
                    if (!exchangeConfigurationUnit.SupportedSharedConfigurations.Contains(exchangeConfigurationUnit2.OrganizationId.ConfigurationUnit))
                    {
                        exchangeConfigurationUnit.SupportedSharedConfigurations.Add(exchangeConfigurationUnit2.Identity);
                    }
                }
            }
            if (base.Fields.IsModified(OrganizationSchema.EnableAsSharedConfiguration))
            {
                exchangeConfigurationUnit.EnableAsSharedConfiguration = this.EnableAsSharedConfiguration;
            }
            if (base.Fields.IsModified(OrganizationSchema.ImmutableConfiguration))
            {
                exchangeConfigurationUnit.ImmutableConfiguration = this.ImmutableConfiguration;
            }
            if (base.Fields.IsModified(OrganizationSchema.IsDehydrated))
            {
                exchangeConfigurationUnit.IsDehydrated = this.IsDehydrated;
            }
            if (base.Fields.IsModified(OrganizationSchema.IsStaticConfigurationShared))
            {
                exchangeConfigurationUnit.IsStaticConfigurationShared = this.IsStaticConfigurationShared;
            }
            if (base.Fields.IsModified(OrganizationSchema.IsUpdatingServicePlan))
            {
                exchangeConfigurationUnit.IsUpdatingServicePlan = this.IsUpdatingServicePlan;
            }
            if (base.Fields.IsModified(ExchangeConfigurationUnitSchema.ProgramId))
            {
                exchangeConfigurationUnit.ProgramId = this.ProgramId;
            }
            if (base.Fields.IsModified(ExchangeConfigurationUnitSchema.OfferId))
            {
                exchangeConfigurationUnit.OfferId = this.OfferId;
            }
            if (base.Fields.IsModified(ExchangeConfigurationUnitSchema.ServicePlan))
            {
                exchangeConfigurationUnit.ServicePlan = this.ServicePlan;
            }
            if (base.Fields.IsModified(ExchangeConfigurationUnitSchema.TargetServicePlan))
            {
                exchangeConfigurationUnit.TargetServicePlan = this.TargetServicePlan;
            }
            if (!exchangeConfigurationUnit.HostingDeploymentEnabled && Datacenter.IsPartnerHostedOnly(false))
            {
                exchangeConfigurationUnit.HostingDeploymentEnabled = true;
            }
            if (base.Fields.IsModified(OrganizationSchema.ExcludedFromBackSync))
            {
                exchangeConfigurationUnit.ExcludedFromBackSync = this.ExcludedFromBackSync;
            }
            if (base.Fields.IsModified(OrganizationSchema.ExcludedFromForwardSyncEDU2BPOS))
            {
                exchangeConfigurationUnit.ExcludedFromForwardSyncEDU2BPOS = this.ExcludedFromForwardSyncEDU2BPOS;
            }
            if (base.Fields.IsModified(ExchangeConfigurationUnitSchema.ExchangeUpgradeBucket))
            {
                if (this.ExchangeUpgradeBucket != null)
                {
                    ExchangeUpgradeBucket exchangeUpgradeBucket = (ExchangeUpgradeBucket)base.GetDataObject <ExchangeUpgradeBucket>(this.ExchangeUpgradeBucket, base.GlobalConfigSession, null, new LocalizedString?(Strings.ErrorExchangeUpgradeBucketNotFound(this.ExchangeUpgradeBucket.ToString())), new LocalizedString?(Strings.ErrorExchangeUpgradeBucketNotUnique(this.ExchangeUpgradeBucket.ToString())));
                    UpgradeBucketTaskHelper.ValidateOrganizationVersion(exchangeConfigurationUnit, exchangeUpgradeBucket, new Task.ErrorLoggerDelegate(base.WriteError));
                    UpgradeBucketTaskHelper.ValidateOrganizationAddition(base.GlobalConfigSession, exchangeConfigurationUnit.OrganizationId, exchangeUpgradeBucket, new Task.ErrorLoggerDelegate(base.WriteError));
                    exchangeConfigurationUnit.ExchangeUpgradeBucket = (ADObjectId)exchangeUpgradeBucket.Identity;
                }
                else
                {
                    exchangeConfigurationUnit.ExchangeUpgradeBucket = null;
                }
            }
            if (base.Fields.IsModified(OrganizationSchema.MailboxRelease))
            {
                exchangeConfigurationUnit.MailboxRelease = this.MailboxRelease;
            }
            if (base.Fields.IsModified(OrganizationSchema.PreviousMailboxRelease))
            {
                exchangeConfigurationUnit.PreviousMailboxRelease = this.PreviousMailboxRelease;
            }
            if (base.Fields.IsModified(OrganizationSchema.PilotMailboxRelease))
            {
                exchangeConfigurationUnit.PilotMailboxRelease = this.PilotMailboxRelease;
            }
            if (base.Fields.IsModified("AddRelocationConstraint"))
            {
                RelocationConstraint      constraintToAdd = new RelocationConstraint((RelocationConstraintType)this.RelocationConstraintType, DateTime.UtcNow.AddDays((double)this.RelocationConstraintExpirationInDays));
                RelocationConstraintArray persistedRelocationConstraints = SetOrganization.PopulateRelocationConstraintsList(exchangeConfigurationUnit.PersistedRelocationConstraints, this.RelocationConstraintType, constraintToAdd);
                exchangeConfigurationUnit.PersistedRelocationConstraints = persistedRelocationConstraints;
            }
            else if (base.Fields.IsModified("RemoveRelocationConstraint"))
            {
                RelocationConstraintArray persistedRelocationConstraints2 = SetOrganization.PopulateRelocationConstraintsList(exchangeConfigurationUnit.PersistedRelocationConstraints, this.RelocationConstraintType, null);
                exchangeConfigurationUnit.PersistedRelocationConstraints = persistedRelocationConstraints2;
            }
            OrganizationStatus organizationStatus;

            if (exchangeConfigurationUnit.IsModified(ExchangeConfigurationUnitSchema.OrganizationStatus) && exchangeConfigurationUnit.TryGetOriginalValue <OrganizationStatus>(ExchangeConfigurationUnitSchema.OrganizationStatus, out organizationStatus))
            {
                if (OrganizationStatus.Active == exchangeConfigurationUnit.OrganizationStatus && (OrganizationStatus.Suspended == organizationStatus || OrganizationStatus.LockedOut == organizationStatus))
                {
                    exchangeConfigurationUnit.IsTenantAccessBlocked = false;
                }
                else if ((OrganizationStatus.Suspended == exchangeConfigurationUnit.OrganizationStatus || OrganizationStatus.LockedOut == exchangeConfigurationUnit.OrganizationStatus) && OrganizationStatus.Active == organizationStatus)
                {
                    exchangeConfigurationUnit.IsTenantAccessBlocked = true;
                }
            }
            if (base.Fields.IsModified(OrganizationSchema.IsLicensingEnforced))
            {
                exchangeConfigurationUnit.IsLicensingEnforced = this.IsLicensingEnforced;
            }
            TaskLogger.LogExit();
            return(exchangeConfigurationUnit);
        }