Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

List of all categories

 Hi,

I have a simple question: how to get a list of all the categories using the JAVA PLAIN API?

 I will be very grateful for help 

0 votes



One answer

Permanent link
Hi Robert,

the code to get the categories of a given project are looks as below:
	/**
	 * 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);
		List categories = 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()); 
		}	
	}

If you have an arbitrary process area (project area/team area) this gives you the associated categories, as far as I can tell.
	/**
	 * 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()); 
		}	
	}

1 vote

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Jan 09 '13, 12:33 p.m.

Question was seen: 4,203 times

Last updated: Jan 10 '13, 2:49 a.m.

Confirmation Cancel Confirm