Beispiel #1
0
        protected virtual void SubmitLinkChange(
            LinkService linkService,
            LinkSubmissionPhase submissionPhase)
        {
            long firstChangeGroupId = 0;
            const LinkChangeGroup.LinkChangeGroupStatus status = LinkChangeGroup.LinkChangeGroupStatus.ReadyForMigration;

            while (true)
            {
                long lastChangeGroupId;
                ReadOnlyCollection <LinkChangeGroup> pagedChangeGroups = linkService.GetLinkChangeGroups(
                    firstChangeGroupId, 10000, status, false, out lastChangeGroupId);

                if (pagedChangeGroups.Count <= 0 || lastChangeGroupId < firstChangeGroupId)
                {
                    break;
                }
                firstChangeGroupId = lastChangeGroupId + 1;

                foreach (LinkChangeGroup changeGroup in pagedChangeGroups)
                {
                    if (linkService.ChangeGroupIsCompleted(changeGroup))
                    {
                        changeGroup.Status = LinkChangeGroup.LinkChangeGroupStatus.Completed;
                    }
                    else if (linkService.AllLinkMigrationInstructionsAreConflicted(changeGroup))
                    {
                        changeGroup.IsConflicted = true;
                    }
                    else
                    {
                        LinkChangeGroup.LinkChangeGroupStatus statusCache = changeGroup.Status;

                        #region to be deleted
                        TraceManager.TraceInformation("Start migration link change group {0}", changeGroup.GroupName);
                        BatchSubmitLinkChange(changeGroup, submissionPhase);
                        TraceManager.TraceInformation("Finish migration link change group {0}", changeGroup.GroupName);

                        // if the change group contains the two special skip change actions
                        // we leave the group status untouched but update the action status changes, if any
                        if (linkService.ContainsSpecialSkipActions(changeGroup))
                        {
                            changeGroup.Status = statusCache;
                        }
                        else if (linkService.AllLinkMigrationInstructionsAreConflicted(changeGroup))
                        {
                            changeGroup.IsConflicted = true;
                        }
                        else if (linkService.ChangeGroupIsCompleted(changeGroup))
                        {
                            changeGroup.Status = LinkChangeGroup.LinkChangeGroupStatus.Completed;
                        }
                        #endregion
                    }
                    linkService.SaveChangeGroupActionStatus(changeGroup);
                }
            }
        }