How to get CustomAttribute from Work Item?
I want to print out all of the Custom Attribute fields from a Work Item. Right now' I'm trying to do something like this:
How can I get the Attribute? Right now I'm getting an Item.
Also, I'm new at the API, so it would be nice if the explanation was "dummbed down" for me :)
On the same token, it would also help if someone has knowledge of more explanatory documentation from the javadoc.
List<IAttributeHandle> customAttributes = currentWI.getCustomAttributes();customAttributes = currentWI.getCustomAttributes();
for(int i = 0; i < customAttributes.size(); i++ ){}
IAttribute item = (IAttribute) this.repository.itemManager().fetchCompleteItem(
customAttributes.get(i), IWorkItem.PRIORITY_PROPERTY, null);System.out.println( item.getDisplayName() );
How can I get the Attribute? Right now I'm getting an Item.
Also, I'm new at the API, so it would be nice if the explanation was "dummbed down" for me :)
On the same token, it would also help if someone has knowledge of more explanatory documentation from the javadoc.
One answer
Minghua,
please start here: https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/ and here https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/
Your question should be answered in the second link above and in https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ as well as in other posts.
You have to cast attribute values to the types expected. e.g. string, int, contributor etc. I think there are numerous examples on my blog.
please start here: https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/ and here https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/
Your question should be answered in the second link above and in https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ as well as in other posts.
You have to cast attribute values to the types expected. e.g. string, int, contributor etc. I think there are numerous examples on my blog.