It's all about the answers!

Ask a question

Error while associating workitem category to teamarea using Java API


Kaushambi Singh (371310379) | asked Jun 25 '13, 3:05 p.m.
 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;
    }


Comments
Kaushambi Singh commented Jun 26 '13, 2:39 a.m.

 Please reply

Be the first one to answer this question!


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.