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

Find custom attribute value from a IWorkItem using Plain Java Api

  I amen't sure how to do this but my method takes in an IWorkItem and gets List of IAttributeHandles these are used to get the display names (as I only need certain custom attributes). This is what I've got so far and ament sure how to get the values.

private static void findCustomAttributes(IWorkItem iWorkItem) throws TeamRepositoryException 
{
// TODO Auto-generated method stub
List<IAttributeHandle> test = iWorkItem.getCustomAttributes();
test = iWorkItem.getCustomAttributes();
String displayName = null;
Object value = null;

for(int h = 0; h <test.size(); h++)
{
testing = (IAttribute)repo.itemManager().fetchCompleteItem(test.get(h), 0, null);

displayName = testing.getDisplayName();
if(displayName.equals("Closed Date"))
{
value = iWorkItem.getValue(testing);
if(value == null)
{
//Do Something
}
else
{
//Do something else
}
}
}
}

I'm going keep hacking away at it but any help would be much appreciated
Thanks

0 votes



One answer

Permanent link
Hi,

in my experience it is a bad idea to match the display name. Use the ID instead, since that is unique. Otherwise you might get a wrong attribute and be puzzled. See http://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ for more information about this topic. The blog contains several more posts you might be interested in too.

1 vote

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

Question asked: Jan 10 '13, 5:16 a.m.

Question was seen: 5,932 times

Last updated: Jan 10 '13, 5:40 a.m.

Confirmation Cancel Confirm