我可以创建 WorkItem 类别,但在将其关联到 teamarea 时出现错误。在 createcategory.getAssociatedTeamAreas().add(newTAHandle) 行中出现错误。我不知道如何在 add 方法中返回 ITteamareaHandle 的布尔对象。得到编译错误:java.lang.UnsupportedOperationException
请帮忙。下面是相关代码。
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;
}