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

Ho to fetch workitem type attribute value?

Hi,

i am using plain java for fetching all work items from project area.

i have one doubt how to fetch value for work item type attribute.

0 votes



6 answers

Permanent link
Please see:

https://jazz.net/forums/viewtopic.php?t=3680
https://jazz.net/forums/viewtopic.php?t=4957
https://jazz.net/forums/viewtopic.php?t=14318
https://jazz.net/forums/viewtopic.php?t=17467
https://jazz.net/forums/viewtopic.php?t=24184
https://jazz.net/forums/viewtopic.php?t=1588

In a nutshell

Find the attribute

IAttribute customString = workItemClient.findAttribute(fProjectArea,
fCustomStringAttributeID, null);


Or iterate the exiting ones:


// List Custom Attributes
List<IAttributeHandle> custAttribs = workItem.getCustomAttributes();
for (Iterator<IAttributeHandle> iterator = custAttribs.iterator(); iterator.hasNext();) {
IAttributeHandle iAttributeHandle = (IAttributeHandle) iterator
.next();
IAttribute iAttribute = (IAttribute)fTeamRepository.itemManager().fetchCompleteItem(iAttributeHandle, 0, null);
System.out.print("Custom: " +iAttribute.getIdentifier()+" \t" +iAttribute.getDisplayName()+" \t"+iAttribute.getAttributeType());
Object value = workItem.getValue(iAttribute);
if(value!=null && value instanceof String) {
String sValue = (String) value;
System.out.print("\tValue: " + sValue);
}
System.out.println();
}


You get the value as an object and need to cast it. Enumerations return ILiteral or something like that. I have no code snippet lying around for that case.

0 votes


Permanent link
My code for finding the values of ALL attributes in a workitem (including enumerations) is here

https://jazz.net/forums/viewtopic.php?t=24762

but if you are asking how to find the workitem TYPES in a project..

the call is

workItemClient.findWorkItemTypes(fProjectArea, monitor)


Sam

0 votes


Permanent link
Hi Sam,

Thank you very much.

Based on your post (
https://jazz.net/forums/viewtopic.php?t=24762) .

i have found the solution for retrieving priority and other values like enumeration , string type values.

But i am unable to retrieve Status (interanalState) attribute and work item type attributes values.

0 votes


Permanent link
Hi Ralph Schoon,

Thank you for your response.

i have followed your post.

check my output below for this line,

System.out.print("Custom: " +customString.getIdentifier()+" \t" +customString.getDisplayName()+" \t"+customString.getAttributeType());

output:

Custom: customerid Customer ID workItem


And it doesn't return any value for work item type of attribute.

0 votes


Permanent link
Hi,

If I read your output correctly it says that the attribute Type identifier returned by IAttribute.getAttributeType() is "workItem".

So I would assume that it was configured to contain work items. Is that not correct?

If you are talking about the state of a work item, the work item has getters and setters for the built in attributes that you can use too.

0 votes


Permanent link
Hi Ralph Schoon,

its correct one of my attribute type is work item.

Please suggest me how to get the value of that attribute(work item type).

And also i am unable to fetch the value of State attribute.

Sorry for my inappropriate post.

I want to read the values of two attributes.

1. work item type attribute
2. State type attribute.

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,930

Question asked: May 08 '12, 5:01 a.m.

Question was seen: 5,050 times

Last updated: May 08 '12, 5:01 a.m.

Confirmation Cancel Confirm