Пример #1
0
 private void CheckMoveStatusInQueuedForStartAfterSet(TransactionalRequestJob moveRequest)
 {
     if (!RequestJobStateNode.RequestStateIs(moveRequest.StatusDetail, RequestState.Queued))
     {
         base.WriteError(new ErrorStartAfterCanBeSetOnlyInQueuedException(), ErrorCategory.InvalidArgument, base.Identity);
     }
 }
Пример #2
0
 protected override void ValidateRequest(TransactionalRequestJob requestJob)
 {
     base.ValidateRequest(requestJob);
     base.ValidateRequestIsActive(requestJob);
     base.ValidateRequestProtectionStatus(requestJob);
     base.ValidateRequestIsRunnable(requestJob);
     base.ValidateRequestIsNotCancelled(requestJob);
     if (!requestJob.Suspend)
     {
         base.WriteVerbose(Strings.RequestNotSuspended(requestJob.Name));
     }
     if (RequestJobStateNode.RequestStateIs(requestJob.StatusDetail, RequestState.Completion) && !RequestJobStateNode.RequestStateIs(requestJob.StatusDetail, RequestState.IncrementalSync))
     {
         base.WriteError(new SuspendWhenReadyToCompleteCannotBeUsedDuringCompletionException(requestJob.Name), ErrorCategory.InvalidArgument, requestJob.Identity);
     }
     using (MailboxReplicationServiceClient mailboxReplicationServiceClient = requestJob.CreateMRSClient(base.ConfigSession, requestJob.WorkItemQueueMdb.ObjectGuid, base.UnreachableMrsServers))
     {
         LocalizedString message = requestJob.Message;
         requestJob.Message = LocalizedString.Empty;
         try
         {
             List <ReportEntry> entries = null;
             using (mailboxReplicationServiceClient.ValidateAndPopulateRequestJob(requestJob, out entries))
             {
                 RequestTaskHelper.WriteReportEntries(requestJob.Name, entries, requestJob.Identity, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskErrorLoggingDelegate(base.WriteError));
             }
         }
         finally
         {
             requestJob.Message = message;
         }
     }
 }
Пример #3
0
 private void CheckMoveStatusWithStartAfterAndCompleteAfterIncrementalSyncInterval(TransactionalRequestJob moveRequest)
 {
     if (moveRequest.IsOffline)
     {
         base.WriteError(new StartAfterOrCompleteAfterCannotBeSetForOfflineMovesException(), ErrorCategory.InvalidArgument, base.Identity);
     }
     if (RequestJobStateNode.RequestStateIs(moveRequest.StatusDetail, RequestState.Completion) && !RequestJobStateNode.RequestStateIs(moveRequest.StatusDetail, RequestState.IncrementalSync))
     {
         base.WriteError(new StartAfterOrCompleteAfterCannotBeSetWhenJobCompletingException(), ErrorCategory.InvalidArgument, base.Identity);
     }
     if (moveRequest.JobType < MRSJobType.RequestJobE15_AutoResume)
     {
         base.WriteError(new StartAfterOrCompleteAfterCannotBeSetOnLegacyRequestsException(), ErrorCategory.InvalidArgument, base.Identity);
     }
 }
Пример #4
0
 protected override void ValidateMoveRequest(TransactionalRequestJob moveRequest)
 {
     this.moveIsOffline = moveRequest.IsOffline;
     base.ValidateMoveRequestIsActive(moveRequest);
     base.ValidateMoveRequestProtectionStatus(moveRequest);
     base.ValidateMoveRequestIsSettable(moveRequest);
     if (moveRequest.RequestJobState == JobProcessingState.InProgress && RequestJobStateNode.RequestStateIs(moveRequest.StatusDetail, RequestState.Cleanup) && moveRequest.IdleTime < TimeSpan.FromMinutes(60.0))
     {
         base.WriteError(new CannotModifyCompletingRequestPermanentException(base.LocalADUser.ToString()), ErrorCategory.InvalidArgument, base.Identity);
     }
     if (moveRequest.Suspend)
     {
         base.WriteVerbose(Strings.MoveAlreadySuspended(base.LocalADUser.ToString()));
     }
 }
Пример #5
0
 protected override void ValidateMoveRequest(TransactionalRequestJob moveRequest)
 {
     base.ValidateMoveRequestIsActive(moveRequest);
     base.ValidateMoveRequestProtectionStatus(moveRequest);
     base.ValidateMoveRequestIsSettable(moveRequest);
     if (!moveRequest.Suspend)
     {
         base.WriteVerbose(Strings.MoveNotSuspended(base.LocalADUser.ToString()));
     }
     if (RequestJobStateNode.RequestStateIs(moveRequest.StatusDetail, RequestState.Cleanup))
     {
         base.WriteError(new SuspendWhenReadyToCompleteCannotBeUsedDuringCompletionException(moveRequest.Identity.ToString()), ErrorCategory.InvalidArgument, moveRequest.Identity);
     }
     if (moveRequest.JobType >= MRSJobType.RequestJobE15_AutoResume && this.SuspendWhenReadyToComplete)
     {
         base.WriteError(new SuspendWhenReadyToCompleteCannotBeUsedOnAutoResumeJobsException(moveRequest.Identity.ToString()), ErrorCategory.InvalidArgument, moveRequest.Identity);
     }
 }
Пример #6
0
 protected override void ValidateRequest(TransactionalRequestJob requestJob)
 {
     base.ValidateRequest(requestJob);
     base.ValidateRequestIsActive(requestJob);
     base.ValidateRequestProtectionStatus(requestJob);
     base.ValidateRequestIsRunnable(requestJob);
     base.ValidateRequestIsNotCancelled(requestJob);
     if (requestJob.RequestJobState == JobProcessingState.InProgress && RequestJobStateNode.RequestStateIs(requestJob.StatusDetail, RequestState.Completion) && !RequestJobStateNode.RequestStateIs(requestJob.StatusDetail, RequestState.IncrementalSync) && requestJob.IdleTime < TimeSpan.FromMinutes(60.0))
     {
         base.WriteError(new CannotModifyCompletingRequestPermanentException(base.RequestName), ErrorCategory.InvalidArgument, this.Identity);
     }
     if (requestJob.Suspend)
     {
         base.WriteVerbose(Strings.RequestAlreadySuspended(base.RequestName));
     }
     if (!string.IsNullOrEmpty(this.SuspendComment) && this.SuspendComment.Length > 4096)
     {
         base.WriteError(new ParameterLengthExceededPermanentException("SuspendComment", 4096), ErrorCategory.InvalidArgument, this.Identity);
     }
 }
Пример #7
0
        protected override void ValidateMoveRequest(TransactionalRequestJob moveRequest)
        {
            base.ValidateMoveRequestIsActive(moveRequest);
            base.ValidateMoveRequestProtectionStatus(moveRequest);
            base.ValidateMoveRequestIsSettable(moveRequest);
            if (base.IsFieldSet("SuspendWhenReadyToComplete"))
            {
                if (moveRequest.IsOffline)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorNoOfflineSuspendWhenReadyToComplete(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
                }
                if (RequestJobStateNode.RequestStateIs(moveRequest.StatusDetail, RequestState.Completion))
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorCannotAutoSuspendMoveAlreadyCompleting(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
                }
            }
            if (base.IsFieldSet("RemoteCredential") && moveRequest.RequestStyle == RequestStyle.IntraOrg)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorNoRemoteCredentialSettingForLocalMove(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
            }
            if (base.IsFieldSet("RemoteGlobalCatalog") && moveRequest.RequestStyle == RequestStyle.IntraOrg)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorNoRemoteGlobalCatalogSettingForLocalMove(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
            }
            if (base.IsFieldSet("RemoteHostName") && moveRequest.RequestStyle == RequestStyle.IntraOrg)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorNoRemoteHostNameSettingForLocalMove(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
            }
            if (base.IsFieldSet("BadItemLimit") && this.BadItemLimit < new Unlimited <int>(moveRequest.BadItemsEncountered))
            {
                base.WriteError(new BadItemLimitAlreadyExceededPermanentException(moveRequest.Name, moveRequest.BadItemsEncountered, this.BadItemLimit.ToString()), ErrorCategory.InvalidArgument, base.Identity);
            }
            if (base.IsFieldSet("LargeItemLimit") && moveRequest.AllowLargeItems)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorIncompatibleParameters("AllowLargeItems", "LargeItemLimit")), ErrorCategory.InvalidArgument, base.Identity);
            }
            if (base.IsFieldSet("LargeItemLimit") && this.LargeItemLimit < new Unlimited <int>(moveRequest.LargeItemsEncountered))
            {
                base.WriteError(new LargeItemLimitAlreadyExceededPermanentException(moveRequest.Name, moveRequest.LargeItemsEncountered, this.LargeItemLimit.ToString()), ErrorCategory.InvalidArgument, base.Identity);
            }
            if (this.PreventCompletion)
            {
                if (moveRequest.IsOffline)
                {
                    base.WriteError(new CannotPreventCompletionForOfflineMovePermanentException(), ErrorCategory.InvalidArgument, this.PreventCompletion);
                }
                if (RequestJobStateNode.RequestStateIs(moveRequest.StatusDetail, RequestState.Completion))
                {
                    base.WriteError(new CannotPreventCompletionForCompletingMovePermanentException(), ErrorCategory.InvalidArgument, this.PreventCompletion);
                }
                if (moveRequest.JobType >= MRSJobType.RequestJobE15_AutoResume)
                {
                    base.WriteError(new SuspendWRTCPreventCompletionCannotBeSetOnNewRequestsException(), ErrorCategory.InvalidArgument, this.PreventCompletion);
                }
            }
            DateTime?timestamp  = moveRequest.TimeTracker.GetTimestamp(RequestJobTimestamp.StartAfter);
            bool     flag       = RequestTaskHelper.CompareUtcTimeWithLocalTime(timestamp, this.StartAfter);
            DateTime?timestamp2 = moveRequest.TimeTracker.GetTimestamp(RequestJobTimestamp.CompleteAfter);
            bool     flag2      = RequestTaskHelper.CompareUtcTimeWithLocalTime(timestamp2, this.CompleteAfter);
            bool     flag3      = base.IsFieldSet("StartAfter") && !flag;
            bool     flag4      = base.IsFieldSet("CompleteAfter") && !flag2;

            if (flag3 || flag4 || base.IsFieldSet("IncrementalSyncInterval"))
            {
                this.CheckMoveStatusWithStartAfterAndCompleteAfterIncrementalSyncInterval(moveRequest);
            }
            if (flag3)
            {
                this.CheckMoveStatusInQueuedForStartAfterSet(moveRequest);
            }
            bool flag5 = base.IsFieldSet("SuspendWhenReadyToComplete") ? this.SuspendWhenReadyToComplete : moveRequest.SuspendWhenReadyToComplete;

            if (flag5 && moveRequest.JobType >= MRSJobType.RequestJobE15_AutoResume)
            {
                base.WriteError(new SuspendWRTCPreventCompletionCannotBeSetOnNewRequestsException(), ErrorCategory.InvalidArgument, this.SuspendWhenReadyToComplete);
            }
            DateTime utcNow = DateTime.UtcNow;

            if (flag3 && this.StartAfter != null)
            {
                RequestTaskHelper.ValidateStartAfterTime(this.StartAfter.Value.ToUniversalTime(), new Task.TaskErrorLoggingDelegate(base.WriteError), utcNow);
            }
            if (base.IsFieldSet("IncrementalSyncInterval"))
            {
                RequestTaskHelper.ValidateIncrementalSyncInterval(this.IncrementalSyncInterval, new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            if (base.IsFieldSet("StartAfter") && flag)
            {
                this.WriteWarning(Strings.WarningScheduledTimeIsUnchanged("StartAfter"));
            }
            if (base.IsFieldSet("CompleteAfter") && flag2)
            {
                this.WriteWarning(Strings.WarningScheduledTimeIsUnchanged("CompleteAfter"));
            }
            if (base.IsFieldSet("TargetDatabase") || base.IsFieldSet("ArchiveTargetDatabase"))
            {
                if (!moveRequest.TargetIsLocal)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorCannotRetargetOutboundMoves(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
                }
                if (!RequestJobStateNode.RequestStateIs(moveRequest.StatusDetail, RequestState.Queued))
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorCanRetargetOnlyQueuedMoves(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
                }
                if (base.IsFieldSet("TargetDatabase") && moveRequest.ArchiveOnly)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorCannotRetargetPrimaryForArchiveOnlyMoves(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
                }
                if (base.IsFieldSet("ArchiveTargetDatabase") && moveRequest.PrimaryOnly)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorCannotRetargetArchiveForPrimaryOnlyMoves(base.LocalADUser.ToString())), ErrorCategory.InvalidArgument, base.Identity);
                }
            }
        }
Пример #8
0
 protected override void ValidateMoveRequest(TransactionalRequestJob moveRequest)
 {
     if (moveRequest.IsFake)
     {
         return;
     }
     if (!base.ParameterSetName.Equals("MigrationMoveRequestQueue"))
     {
         base.ValidateMoveRequestProtectionStatus(moveRequest);
         if (moveRequest.ValidationResult == RequestJobBase.ValidationResultEnum.Valid)
         {
             base.ValidateMoveRequestIsActive(moveRequest);
             if (moveRequest.RequestJobState == JobProcessingState.InProgress && RequestJobStateNode.RequestStateIs(moveRequest.StatusDetail, RequestState.Cleanup) && moveRequest.IdleTime < TimeSpan.FromMinutes(60.0))
             {
                 base.WriteError(new CannotModifyCompletingRequestPermanentException(base.LocalADUser.ToString()), ErrorCategory.InvalidArgument, base.Identity);
             }
             if (moveRequest.CancelRequest)
             {
                 base.WriteVerbose(Strings.MoveAlreadyCanceled);
             }
             if (moveRequest.Status == RequestStatus.Completed || moveRequest.Status == RequestStatus.CompletedWithWarning)
             {
                 this.mrCondition = RemoveMoveRequest.MoveRequestCondition.MoveCompleted;
                 return;
             }
         }
         else
         {
             this.mrCondition = RemoveMoveRequest.MoveRequestCondition.FailedValidation;
         }
     }
 }
Пример #9
0
 protected override void ValidateRequest(TransactionalRequestJob requestJob)
 {
     if (requestJob.IsFake)
     {
         return;
     }
     base.ValidateRequest(requestJob);
     if (!base.ParameterSetName.Equals("MigrationRequestQueue"))
     {
         base.ValidateRequestProtectionStatus(requestJob);
         if (requestJob.ValidationResult == RequestJobBase.ValidationResultEnum.Valid)
         {
             base.ValidateRequestIsActive(requestJob);
             if (requestJob.RequestJobState == JobProcessingState.InProgress && RequestJobStateNode.RequestStateIs(requestJob.StatusDetail, RequestState.Completion) && !RequestJobStateNode.RequestStateIs(requestJob.StatusDetail, RequestState.IncrementalSync) && requestJob.IdleTime < TimeSpan.FromMinutes(60.0))
             {
                 base.WriteError(new CannotModifyCompletingRequestPermanentException(base.IndexEntry.ToString()), ErrorCategory.InvalidArgument, this.Identity);
             }
             if (requestJob.CancelRequest)
             {
                 base.WriteVerbose(Strings.RequestAlreadyCanceled);
             }
             if (requestJob.Status == RequestStatus.Completed || requestJob.Status == RequestStatus.CompletedWithWarning)
             {
                 if (this.requestCondition != RemoveRequest <TIdentity> .RequestCondition.None && this.requestCondition != RemoveRequest <TIdentity> .RequestCondition.Completed)
                 {
                     base.WriteError(new CannotRemoveCompletedDuringCancelPermanentException(base.IndexEntry.ToString()), ErrorCategory.InvalidArgument, this.Identity);
                 }
                 this.requestCondition = RemoveRequest <TIdentity> .RequestCondition.Completed;
                 return;
             }
         }
         else
         {
             this.requestCondition = RemoveRequest <TIdentity> .RequestCondition.FailedValidation;
         }
     }
 }