Esempio n. 1
0
        public List <ILink> GetLinks(
            IArtifact sourceArtifact,
            LinkType linkType)
        {
            string id;
            bool   idExtractionRslt = TryExtractArtifactId(sourceArtifact, out id);

            Debug.Assert(idExtractionRslt);

            string[]  identity   = UtilityMethods.ParseCQRecordMigrationItemId(id);
            OAdEntity hostEntity = CQWrapper.GetEntity(m_userSession, identity[0], identity[1]);

            var links = new List <ILink>();

            if (null == ExtractLinkChangeActionsCallback)
            {
                return(links);
            }

            var perWorkItemlinkChangeGroups = new List <LinkChangeGroup>();

            ExtractLinkChangeActionsCallback(m_userSession, hostEntity, perWorkItemlinkChangeGroups);

            foreach (LinkChangeGroup group in perWorkItemlinkChangeGroups)
            {
                foreach (LinkChangeAction action in group.Actions)
                {
                    if (!CQStringComparer.LinkType.Equals(action.Link.LinkType.ReferenceName, linkType.ReferenceName))
                    {
                        continue;
                    }

                    string mappedLinkType = m_linkConfigLookupService.FindMappedLinkType(m_configurationService.SourceId, action.Link.LinkType.ReferenceName);
                    if (!m_linkTranslationService.LinkTypeSupportedByOtherSide(mappedLinkType))
                    {
                        continue;
                    }

                    if (!links.Contains(action.Link))
                    {
                        links.Add(action.Link);
                    }
                }
            }

            return(links);
        }
Esempio n. 2
0
        public virtual List <ILink> GetLinks(
            IArtifact sourceArtifact,
            LinkType linkType)
        {
            string id;
            bool   idExtractionRslt = TryExtractArtifactId(sourceArtifact, out id);

            Debug.Assert(idExtractionRslt);

            int      workItemId             = int.Parse(id);
            WorkItem workItem               = m_migrationSource.WorkItemStore.WorkItemStore.GetWorkItem(workItemId);
            var      sourceArtifactWorkItem = new TfsMigrationWorkItem(m_migrationSource.WorkItemStore.Core, workItem);

            var perWorkItemlinkChangeGroups = new List <LinkChangeGroup>();

            ExtractLinkChangeActionsCallback(sourceArtifactWorkItem, perWorkItemlinkChangeGroups, null);

            var links = new List <ILink>();

            foreach (LinkChangeGroup group in perWorkItemlinkChangeGroups)
            {
                foreach (LinkChangeAction action in group.Actions)
                {
                    if (!action.Link.LinkType.ReferenceName.Equals(linkType.ReferenceName))
                    {
                        continue;
                    }

                    string mappedLinkType = m_linkTranslationService.LinkConfigurationLookupService.FindMappedLinkType(
                        m_configurationService.SourceId, action.Link.LinkType.ReferenceName);
                    if (!m_linkTranslationService.LinkTypeSupportedByOtherSide(mappedLinkType))
                    {
                        continue;
                    }

                    if (!links.Contains(action.Link))
                    {
                        links.Add(action.Link);
                    }
                }
            }

            return(links);
        }