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
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
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/
Comments
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
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>
<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>