我可以創建WorkItem類別,但在將它與create_type.getAssociatedTeamAreas()。add(newTAHandle)行中的teamarea.Getting錯誤關聯時出錯。我沒有得到如何返回一個ITeamAreaHandle布爾對象添加方法。獲取編譯錯誤:java.lang.UnsupportedOperationException將工作項類別與RTC中的團隊區域相關聯
請幫忙。以下是相關的代碼。
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;
}
好在我已試過,但並不團隊區域類別相關聯。我想過使用這種語法:((Category)createcat).getAssociatedTeamAreas()。add(teamArea);但它會拋出與上面相同的錯誤。 –
@KaushambiSuyal好吧,也許它與'newTAHandle'類型有關?我的意思是:如果你必須將'ICategory'轉換爲'Category',可能類似的轉換是爲了'ITeamAreaHandle'(轉換爲內部類型)? – VonC