internal void UpdateInPlace(string serverFqdn, string serverLegacyDN, string lastMountedServerFqdn, string lastMountedServerLegacyDN, string databaseLegacyDN, string rpcClientAcessServerLegacyDN, string databaseName, bool databaseIsPublic, bool databaseIsRestored, Guid homePublicFolderDatabaseGuid, DateTime mountedTime, Guid?serverGuid, ADObjectId serverSite, ServerVersion serverVersion, MailboxRelease mailboxRelease, DatabaseLocationInfoResult requestResult, bool isDatabaseHighlyAvailable)
 {
     if (serverFqdn != null && serverFqdn.Length == 0)
     {
         throw new ArgumentException("serverFqdn is empty", "serverFqdn");
     }
     if (serverLegacyDN != null && serverLegacyDN.Length == 0)
     {
         throw new ArgumentException("serverLegacyDN is empty", "serverLegacyDN");
     }
     if (lastMountedServerFqdn != null && lastMountedServerFqdn.Length == 0)
     {
         throw new ArgumentException("lastMountedServerFqdn is empty", "lastMountedServerFqdn");
     }
     if (lastMountedServerLegacyDN != null && lastMountedServerLegacyDN.Length == 0)
     {
         throw new ArgumentException("lastMountedServerLegacyDN is empty", "lastMountedServerLegacyDN");
     }
     this.ServerFqdn       = serverFqdn;
     this.ServerLegacyDN   = serverLegacyDN;
     this.DatabaseLegacyDN = databaseLegacyDN;
     this.RpcClientAccessServerLegacyDN = rpcClientAcessServerLegacyDN;
     this.DatabaseName                 = databaseName;
     this.DatabaseIsPublic             = databaseIsPublic;
     this.DatabaseIsRestored           = databaseIsRestored;
     this.HomePublicFolderDatabaseGuid = homePublicFolderDatabaseGuid;
     this.serverGuid                = serverGuid;
     this.ServerSite                = serverSite;
     this.AdminDisplayVersion       = serverVersion;
     this.MailboxRelease            = mailboxRelease;
     this.IsDatabaseHighlyAvailable = isDatabaseHighlyAvailable;
     this.LastMountedServerFqdn     = (lastMountedServerFqdn ?? serverFqdn);
     this.LastMountedServerLegacyDN = (lastMountedServerLegacyDN ?? serverLegacyDN);
     this.MountedTime               = mountedTime;
     this.RequestResult             = requestResult;
 }
Example #2
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            IRecipientSession recipientSession = (IRecipientSession)base.DataSession;

            if (this.GenerateExternalDirectoryObjectId && string.IsNullOrEmpty(this.DataObject.ExternalDirectoryObjectId))
            {
                this.DataObject.ExternalDirectoryObjectId = Guid.NewGuid().ToString();
            }
            if (this.BusinessNetID != null)
            {
                this.DataObject.ConsumerNetID = this.DataObject.NetID;
                this.DataObject.NetID         = this.BusinessNetID;
            }
            if (this.CopyShadowAttributes)
            {
                foreach (PropertyDefinition propertyDefinition in this.DataObject.Schema.AllProperties)
                {
                    ADPropertyDefinition adpropertyDefinition = propertyDefinition as ADPropertyDefinition;
                    if (adpropertyDefinition != null)
                    {
                        object value = null;
                        if (adpropertyDefinition.ShadowProperty != null && this.DataObject.propertyBag.TryGetField(adpropertyDefinition, ref value))
                        {
                            this.DataObject.propertyBag[adpropertyDefinition.ShadowProperty] = value;
                        }
                    }
                }
            }
            if (this.EnableAccount.IsPresent && this.DataObject.UserAccountControl == (UserAccountControlFlags.AccountDisabled | UserAccountControlFlags.PasswordNotRequired | UserAccountControlFlags.NormalAccount))
            {
                this.DataObject.UserAccountControl = UserAccountControlFlags.NormalAccount;
                using (SecureString randomPassword = MailboxTaskUtilities.GetRandomPassword(this.DataObject.Name, this.DataObject.SamAccountName))
                {
                    recipientSession.SetPassword(this.DataObject, randomPassword);
                }
            }
            if (base.Fields.IsModified(ADRecipientSchema.LEOEnabled))
            {
                this.DataObject.LEOEnabled = this.LEOEnabled;
            }
            if (base.Fields.IsModified("UpgradeMessage"))
            {
                this.DataObject.UpgradeMessage = this.UpgradeMessage;
            }
            if (base.Fields.IsModified("UpgradeDetails"))
            {
                this.DataObject.UpgradeDetails = this.UpgradeDetails;
            }
            if (base.Fields.IsModified("UpgradeStage"))
            {
                this.DataObject.UpgradeStage = this.UpgradeStage;
            }
            if (base.Fields.IsModified("UpgradeStageTimeStamp"))
            {
                this.DataObject.UpgradeStageTimeStamp = this.UpgradeStageTimeStamp;
            }
            if (base.Fields.IsModified("MailboxRelease"))
            {
                this.DataObject.MailboxRelease = this.MailboxRelease;
            }
            if (base.Fields.IsModified("ArchiveRelease"))
            {
                this.DataObject.ArchiveRelease = this.ArchiveRelease;
            }
            base.InternalProcessRecord();
            TaskLogger.LogExit();
        }
 internal DatabaseLocationInfo(string serverFqdn, string serverLegacyDN, string lastMountedServerFqdn, string lastMountedServerLegacyDN, string databaseLegacyDN, string rpcClientAcessServerLegacyDN, string databaseName, bool databaseIsPublic, bool databaseIsRestored, Guid homePublicFolderDatabaseGuid, DateTime mountedTime, Guid?serverGuid, ADObjectId serverSite, ServerVersion serverVersion, MailboxRelease mailboxRelease, DatabaseLocationInfoResult requestResult, bool isDatabaseHighlyAvailable)
 {
     this.UpdateInPlace(serverFqdn, serverLegacyDN, lastMountedServerFqdn, lastMountedServerLegacyDN, databaseLegacyDN, rpcClientAcessServerLegacyDN, databaseName, databaseIsPublic, databaseIsRestored, homePublicFolderDatabaseGuid, mountedTime, serverGuid, serverSite, serverVersion, mailboxRelease, requestResult, isDatabaseHighlyAvailable);
 }