Error while associating workitem category to teamarea using Java API
I could create WorkItem categories but getting an error while associating it to the teamarea.
Getting error in the line createcategory.getAssociatedTeamAreas().add(newTAHandle). I am not getting how to return a boolean object of ITeamAreaHandle inside add method. Getting the compilation error : java.lang.UnsupportedOperationException
Please help. Below is the related code.
IWorkItemClient wservice = (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);
ICategory createcategory = wservice.createCategory(area, categoryName, null);
wservice.saveCategory(createcat, null);
if (!teamArea.equals("NULL")){
List teamAreas = area.getTeamAreas();
List <TeamAreaHandle> teamlist = teamAreas;
ITeamAreaHandle newTAHandle = findTeamAreaByName(teamlist,teamAreaName,monitor);
createcategory.getAssociatedTeamAreas().add(newTAHandle);
}
//Method findTeamAreaByName
private static ITeamAreaHandle findTeamAreaByName (List<TeamAreaHandle> teamlist, String teamAreaID, IProgressMonitor monitor) throws TeamRepositoryException {
for (ITeamAreaHandle teamAreaHandle : teamlist) {
ITeamArea teamArea = (ITeamArea)teamRepository.itemManager().fetchCompleteItem(teamAreaHandle,ItemManager.DEFAULT,monitor);
if (teamAreaID.equals(teamArea.getName())) {
return teamAreaHandle;
}
}
return null;
}
|
Be the first one to answer this question!
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.
Comments
Please reply