private bool LinksMatch(Guid link1MigrationSourceId, ILink link1, Guid link2MigrationSourceId, ILink link2, out WitDiffLink diffLink)
        {
            if (m_serverDiffEngine.DiffServiceContainer == null)
            {
                Debug.Fail("m_serverDiffEngine.DiffServiceContainer is null");
                throw new ArgumentNullException("m_serverDiffEngine.DiffServiceContainer");
            }

            ILinkTranslationService linkTranslationService = m_serverDiffEngine.DiffServiceContainer.GetService(typeof(ILinkTranslationService)) as ILinkTranslationService;

            if (linkTranslationService == null)
            {
                throw new ArgumentNullException("linkTranslationService");
            }
            if (linkTranslationService.LinkConfigurationLookupService == null)
            {
                throw new ArgumentNullException("linkTranslationService.LinkConfigurationLookupService");
            }

            string mappedSourceLinkType = linkTranslationService.LinkConfigurationLookupService.FindMappedLinkType(
                link1MigrationSourceId, link1.LinkType.SourceArtifactType.ContentTypeReferenceName);

            if (!string.Equals(mappedSourceLinkType, link2.LinkType.SourceArtifactType.ContentTypeReferenceName, StringComparison.Ordinal))
            {
                diffLink = new WitDiffLink("SourceArtifactContentType", link1.LinkType.SourceArtifactType.FriendlyName, link2.LinkType.SourceArtifactType.FriendlyName);
                return(false);
            }

            string mappedTargetLinkType = linkTranslationService.LinkConfigurationLookupService.FindMappedLinkType(
                link1MigrationSourceId, link1.LinkType.TargetArtifactType.ContentTypeReferenceName);

            if (!string.Equals(mappedTargetLinkType, link2.LinkType.TargetArtifactType.ContentTypeReferenceName, StringComparison.Ordinal))
            {
                diffLink = new WitDiffLink("TargetArtifactContentType", link1.LinkType.TargetArtifactType.FriendlyName, link2.LinkType.TargetArtifactType.FriendlyName);
                return(false);
            }

            /* TODO: Need to use a Translation method something like LinkEngine.TranslateChangeGroup() does to enable this
             * comparison to work
             * if (!string.Equals(link1.SourceArtifact.Uri.ToString(), link2.SourceArtifact.Uri.ToString(), StringComparison.Ordinal))
             * {
             *  diffLink = new WitDiffLink("SourceArtifactUri", link1.SourceArtifact.Uri.ToString(), link2.SourceArtifact.Uri.ToString());
             *  return false;
             * }
             * if (!string.Equals(link1.TargetArtifact.Uri.ToString(), link2.TargetArtifact.Uri.ToString(), StringComparison.Ordinal))
             * {
             *  diffLink = new WitDiffLink("TargetArtifactUri", link1.TargetArtifact.Uri.ToString(), link2.TargetArtifact.Uri.ToString());
             *  return false;
             * }
             */

            if (!string.Equals(link1.Comment, link2.Comment, StringComparison.Ordinal))
            {
                diffLink = new WitDiffLink("Comment", link1.Comment, link2.Comment);
                return(false);
            }

            diffLink = null;
            return(true);
        }
Beispiel #2
0
        public virtual void Initialize(ServiceContainer serviceContainer)
        {
            Debug.Assert(null != serviceContainer, "ServiceContainer is NULL");
            m_serviceContainer = serviceContainer;

            m_linkTranslationService = serviceContainer.GetService(typeof(ILinkTranslationService)) as ILinkTranslationService;
            Debug.Assert(null != m_linkTranslationService, "ILinkTranslationService has not been properly initialized");

            m_configurationService = serviceContainer.GetService(typeof(ConfigurationService)) as ConfigurationService;
            Debug.Assert(null != m_configurationService, "ConfigurationService has not been properly initialized");

            m_hwmLink = new HighWaterMark <DateTime>(Toolkit.Constants.HwmDeltaLink);
            m_configurationService.RegisterHighWaterMarkWithSession(m_hwmLink);

            InitializeTfsClient();

            RegisterArtifactHandlers();
        }
Beispiel #3
0
        public void Initialize(ServiceContainer serviceContainer)
        {
            Debug.Assert(null != serviceContainer, "ServiceContainer is NULL");

            m_serviceContainer = serviceContainer;

            m_linkTranslationService = serviceContainer.GetService(typeof(ILinkTranslationService)) as ILinkTranslationService;
            Debug.Assert(null != m_linkTranslationService, "ILinkTranslationService has not been properly initialized");

            m_configurationService = serviceContainer.GetService(typeof(ConfigurationService)) as ConfigurationService;
            Debug.Assert(null != m_configurationService, "ConfigurationService has not been properly initialized");

            m_hwmLink = new HighWaterMark <DateTime>(ClearQuestConstants.CqLinkHwm);
            m_configurationService.RegisterHighWaterMarkWithSession(m_hwmLink);

            m_linkConfigLookupService = m_linkTranslationService.LinkConfigurationLookupService;

            m_conflictManager = serviceContainer.GetService(typeof(ConflictManager)) as ConflictManager;

            InitializeClient();

            RegisterArtifactHandlers();

            MigrationSource migrSrcConfig = m_configurationService.MigrationSource;

            Debug.Assert(null != migrSrcConfig, "cannot get MigrationSource config from Session");
            foreach (CustomSetting setting in migrSrcConfig.CustomSettings.CustomSetting)
            {
                if (setting.SettingKey.Equals(ClearQuestConstants.CqWebRecordUrlBaseSettingKey, StringComparison.OrdinalIgnoreCase))
                {
                    string urlFormat           = setting.SettingValue;
                    var    recordHyperLinkType = new ClearQuestWebRecordLinkType(urlFormat);
                    m_supportedLinkTypes.Add(recordHyperLinkType.ReferenceName, recordHyperLinkType);
                    ExtractLinkChangeActionsCallback += ((ILinkHandler)recordHyperLinkType).ExtractLinkChangeActions;
                    break;
                }
            }
        }