It's all about the answers!

Ask a question

Not able to get the link information for changeset


sundarrajan rangarajan (3134) | asked Mar 19 '12, 6:07 a.m.
Hi,
below is the piece of code for getting the changesets for an wotkitem.


public static void getChangeSets(IWorkItem workItem) throws TeamRepositoryException {
workSpaceManager = SCMPlatform.getWorkspaceManager(teamRepository);
IProgressMonitor monitor = new SysoutProgressMonitor();
ILinkManager fLinkManager = (ILinkManager) teamRepository.getClientLibrary(ILinkManager.class);
IReferenceFactory fReferenceFactory = fLinkManager.referenceFactory();
IReference reference = fReferenceFactory.createReferenceToItem(workItem.getItemHandle());
ILinkQueryPage page;
page = fLinkManager.findLinksByTarget("com.ibm.team.filesystem.workitems.change_set", reference, monitor);
System.out.println("page size "+page.getSize()); ---> this is getting the count of changesets correctly
//ILinkCollection linkCollection = page.getLinks();

//Collection<ILink> links = linkCollection.getLinksById("com.ibm.team.filesystem.workitems.change_set");
Collection<ILink> links = page.getLinks().getLinksById("com.ibm.team.filesystem.workitems.change_set");
if (links.isEmpty()) --->this is becoming true always
System.out.println("link is empty "+ links.size());-- this is always empty
else
System.out.println("link is not empty");
Iterator<ILink> iter = links.iterator();

while (iter.hasNext())
{
ILink link = iter.next();
System.out.println("inside changeset function");
}
}


I am not able to get the links for changeset from the page . can somebody let me know where I am going wrong

3 answers



permanent link
Ralph Schoon (63.3k33646) | answered Mar 19 '12, 11:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi,

I am not sure what and in which context you are trying this. I would try to use the WorkItemWorkingCopy.getReferences() to get the links on the work item. I haven't tried the way you do it, so i don't have example code.

this looks odd, because you just created the reference.
page = fLinkManager.findLinksByTarget("com.ibm.team.filesystem.workitems.change_set", reference, monitor);

permanent link
sundarrajan rangarajan (3134) | answered Mar 20 '12, 6:49 a.m.
Hi,

I am not sure what and in which context you are trying this. I would try to use the WorkItemWorkingCopy.getReferences() to get the links on the work item. I haven't tried the way you do it, so i don't have example code.

this looks odd, because you just created the reference.
page = fLinkManager.findLinksByTarget("com.ibm.team.filesystem.workitems.change_set", reference, monitor);


My idea is to get the changesets associated with workitem and also to get the names of programs for this changeset. from the example you give, how to get/identify the changeset references in a workitem.

thanks,
Sundar

permanent link
Ralph Schoon (63.3k33646) | answered Mar 20 '12, 7:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I found these links:
- https://jazz.net/forums/viewtopic.php?t=4893
- https://jazz.net/forums/viewtopic.php?t=2404

but have no code that works so far.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.