Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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:


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.

0 votes



One answer

Permanent link
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.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,940

Question asked: Dec 09 '13, 10:12 a.m.

Question was seen: 5,102 times

Last updated: Dec 09 '13, 10:50 a.m.

Confirmation Cancel Confirm