Unable to link Custom Work Item with Change Set
public boolean link(ITeamRepository repository,
IWorkItemHandle workItemHandle, IChangeSetHandle chgSetHandle)
throws AutoconfigProcessorRTCException {
WorkItemWorkingCopy wc = null;
IWorkItemClient service = null;
IItemReference reference = null;
IEndPointDescriptor endpoint = null;
IDetailedStatus detailStatus = null;
IItemType itemType = null;
IItemHandle itemHandle = null;
try {
service = (IWorkItemClient) repository
.getClientLibrary(IWorkItemClient.class);
System.out.println("WorkItemHandle" + workItemHandle.getItemType().getName());
wc = service.getWorkItemWorkingCopyManager().getWorkingCopy(
workItemHandle);
itemType = chgSetHandle.getItemType();
System.out.println("ItemType: "+ itemType.getName());
itemHandle = itemType.createItemHandle(chgSetHandle.getItemId(),
chgSetHandle.getStateId());
reference = IReferenceFactory.INSTANCE
.createReferenceToItem(itemHandle);
endpoint = LinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.RELATED_CHANGE_MANAGEMENT).getTargetEndPointDescriptor();
wc.getReferences().add(endpoint, reference);
} catch (AutoconfigProcessorRTCException e) {
throw new AutoconfigProcessorRTCException(
"Error linking workitem with change set");
}catch(Exception e){
logger.info("Exception" + e.getMessage());
logger.info("Exception" + e.getCause());
}
logger.info("The workitem was associated successfully to change set");
return true;
}
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 19 '15, 2:13 a.m.This is one of the worst questions I have ever seen. No information about what you see and what you do and why.