Not able to get the link information for changeset
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
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);
//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
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
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);
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);
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