How to get all the data values that are inside a custom attribute?
Hi,
I have a custom Attribute that has n number of data that can be selected from RTC front hand. What I am trying to do is get all the data that are included in the attribute IAttribute custom = workItemClient.findAttribute(projectArea,"affected_environments", progressMonitor); System.out.println( "Value "+workItem.getValue(custom)); This above code only gives me default value . Is there any way i can get the list of all the data that are associated with that attribute? Thanks |
Accepted answer
Ralph Schoon (63.5k●3●36●46)
| answered Apr 09 '13, 3:26 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please have a look at http://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ and for enumerations here: http://rsjazz.wordpress.com/2012/08/20/manipulationg-work-item-enumeration-values/
kishan adhi selected this answer as the correct answer
Comments
Ralph Schoon
commented Apr 09 '13, 3:28 p.m.
| edited Apr 09 '13, 3:32 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You need to get the client library workitemCommon. The code below shows it for the workitemClient, but the pattern is the same.
IWorkItemClient workItemClient = (IWorkItemClient) teamRepository().getClientLibrary(IWorkItemClient.class); WorkitemCommon would look like:
IWorkItemCommon workItemCommon = (IWorkItemCommon) teamRepository().getClientLibrary(IWorkItemCommon.class); |
2 other answers
Thank you guys for your time and suggestion.
For other reader this link also might be helpful https://jazz.net/forum/questions/52722/getset-the-displayed-name-of-an-enumeration-type-attribute Thanks |
do you mean this is a variable that holds one selection of an enumeration, and you would like to get all the values of the enumeration?
<code> List<ILiteral> enumerationLiterals = (List<ILiteral>) workItemCommon .resolveEnumeration(ia, monitor).getEnumerationLiterals(); System.out.println("\t\t\t\thave an enumeration list (V4 and up)"); List<Identifier> ial = (List<Identifier>)ia.getValue(auditableClient, workItem, monitor); System.out.println("\t\t\t\t there are " + ial.size() + " entries selected"); for(int r=0;r<ial.size();r++) { for (ILiteral literal : enumerationLiterals) { if (literal.getIdentifier2().getStringIdentifier() .equalsIgnoreCase(ial.get(r).getStringIdentifier())) { System.out.println("\t\t\t\t entry "+ (r+1) + " --> + " literal=" + literal.getIdentifier2().getStringIdentifier() + " literal value=" + literal.getName()); break; } } } </code> Comments
kishan adhi
commented Apr 09 '13, 2:48 p.m.
I dont know how to initialize variable
|
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.