How to fetch change set data from links
I am using the below code :
But there is some exception like :
com.ibm.team.repository.common.ItemNotFoundException: CRJAZ0215E The following record was not found in the database: com.ibm.team.scm.common.internal.impl.ChangeSetHandleImpl
2 answers
This is code that worked for me
IWorkItemReferences wiReferences = workItemCommon .resolveWorkItemReferences(workItem, monitor); List<ichangesethandle> changeSetHandles = new ArrayList<ichangesethandle>(); List<ireference> references = wiReferences .getReferences(ILinkTypeRegistry.INSTANCE.getLinkType( WorkItemLinkTypes.CHANGE_SET) .getSourceEndPointDescriptor()); for (IReference reference : references) { if (reference.isItemReference()) { IItemHandle refItem = (IItemHandle) reference.resolve(); if (refItem instanceof IChangeSetHandle) { changeSetHandles.add((IChangeSetHandle) refItem); } } }@SuppressWarnings("rawtypes") List changeSets = itemManager.fetchCompleteItems(changeSetHandles, IItemManager.DEFAULT, monitor); for (Object object : changeSets) { if (object instanceof IChangeSet) { IChangeSet changeSet = (IChangeSet) object;
......... </ireference></ichangesethandle></ichangesethandle>
Comments
@Ralph I have some change sets which have link type id : com.ibm.team.workitem.linktype.scm.tracksChanges
and then I am using the code which you have shared but it returns null value and exception that the item is not found in the database even though the change set is there.
Any help would be appreciable.
Surely there is some issue in this line :
I have URIReference of change sets. Is there any other way to fetch URI references?
The code I shared works for me. I don't get null pointers and I am passing an array of the IChangeSetHandles to the call you surely say to be wrong and NOT the references.
I can not remote debug.
I have reference.isURIReference() type, shall I use the same code to fetch complete change set?