How can I list the categories in my project area and associated team?
I'm trying to find a way to get a list of the Categories defined in my project area and the team area associated to each category. I have the IProjectArea, but didn't see any way to get the list of Categories (the Categories tab on the project area) and the team area that is associated to each.
Can someone help?
Susan
Can someone help?
Susan
One answer
Susan,
the code below shows how to do that. You can find the code here @ JazzHub:
the code below shows how to do that. You can find the code here @ JazzHub:
/** * Print the Categories for a given Project Area * * @param teamRepository * @param projectArea * @param monitor * @throws TeamRepositoryException */ private static void printProjectAreaCategories(ITeamRepository teamRepository, IProjectArea projectArea, IProgressMonitor monitor) throws TeamRepositoryException { IWorkItemClient workItemClient = (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class); Listcategories = workItemClient.findCategories(projectArea, ICategory.FULL_PROFILE, monitor); System.out.println("Categories of Project Area:"); for (ICategory iCategory : categories) { System.out.println("\tID: " + iCategory.getCategoryId() + "\tName: " + iCategory.getName()); } } /** * Print the Categories for a given Process Area * * @param teamRepository * @param processArea * @param monitor * @throws TeamRepositoryException */ private static void printProcessAreaCategories(ITeamRepository teamRepository, IProcessArea processArea, IProgressMonitor monitor) throws TeamRepositoryException { IWorkItemClient workItemClient = (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class); List categories = workItemClient.findCategoriesOfProcessArea(processArea, ICategory.FULL_PROFILE, monitor); System.out.println("Categories of Process Area:"); for (ICategory iCategory : categories) { System.out.println("\tID: " + iCategory.getCategoryId() + "\tName: " + iCategory.getName()); } }