It's all about the answers!

Ask a question

Retrieving Enumerations in RTC Jazz


Yazhini Churchill (2135) | asked Sep 14 '12, 3:38 a.m.
The programmatic method to retrieve an enummeration is by using  :
IEnumeration enumeration= workItemCommon.resolveEnumeration(attribute, monitor);

However in our case no attributes are tagged to the enumeration we are trying to retrieve. So the above method cannot be used.

Is there an alternate way to accomplish this ? Please help

Thanks

One answer



permanent link
Jared Russell (1.3k12019) | answered Sep 14 '12, 9:13 a.m.
edited Sep 14 '12, 9:18 a.m.
 There is a way that I've found however it's not particularly pretty, and essentially requires you to manually process the process configuration source. The below example iterates through all enumerations and prints out the id and name, and the id and name of all literals within the enumeration (see here for a slightly better formatted version):

ITeamRepository repository = ...
String projectUri = ...
IProcessItemService processItemService = 
	(IProcessItemService) repository.getClientLibrary(IProcessItemService.class);
IProjectArea projectArea = 
	(IProjectArea) processItemService.findProcessArea(URI.create(projectUri), null, null);
IClientProcess clientProcess = 
	processItemService.getClientProcess(projectArea, null);
IProcessConfigurationData enumerationConfigurationData = 
	clientProcess.getProjectConfigurationData("com.ibm.team.workitem.configuration.enumerations", null);
for(IProcessConfigurationElement enumerationElement : enumerationConfigurationData.getElements()) {
	System.out.println("Enumeration Id: " + enumerationElement.getAttribute("attributeTypeId"));
	System.out.println("Enumeration Name: " + enumerationElement.getName());
	for(IProcessConfigurationElement literalElement : enumerationElement.getChildren()) {
		System.out.println("\tId: " + literalElement.getAttribute("id") 
				+ " Name: " + literalElement.getAttribute("name"));
	}
}
	
	
	

Your answer


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.