Retrieving Enumerations in RTC Jazz
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
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
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"));
}
}