It's all about the answers!

Ask a question

Retreiving information from a WorkItem using Plain Java


Jonathan Taylor (111) | asked Oct 12 '09, 6:44 a.m.
Hi, I am very new to RTC and have been writing some plain java code to extract information from a workItem.

Assume I have extracted the correct work item and a IWorkItem object has been extracted. I can now extract information such as the creator, severity, owner, amoung other things.

I also have several other attributes such as Category, ODC Impact and a few others which I believe are custom ones. How do I go about accessing the information contained within these fields since the methods do not seem to be there to allow me to do this.

The last one is the Status of the workItem, I need to be able to return a String which contains the current Status of a workItem but I cannot find a way to do this.

Any help on this would be very much appreciated.

Jonathan Taylor

3 answers



permanent link
Jonathan Taylor (111) | answered Oct 13 '09, 5:10 a.m.
I have finally figured out the custom Attributes, after playing around with it a little more.

I am however still stuck as to how to retreive the Status of a WorkItem, since this does not seem to be held within the workItem itself.

permanent link
Patrick Streule (4.9k21) | answered Oct 13 '09, 8:54 a.m.
JAZZ DEVELOPER
I also have several other attributes such as Category, ODC Impact and
a few others which I believe are custom ones. How do I go about
accessing the information contained within these fields since the
methods do not seem to be there to allow me to do this.

All attribute values, bot custom and built-in can be accessed using:

IAttribute attribute= workItemClient.findAttribute(projectArea,
IWorkItem.XY_PROPERTY_ID, monitor);
Object value= workItem.getValue(attribute);

The last one is the Status of the workItem, I need to be able to
return a String which contains the current Status of a workItem but I
cannot find a way to do this.

IWorkflowInfo info= workItemClient.findWorkflowInfo(workItem, monitor);
String name= info.getStateName(workItem.getState2());

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Jonathan Taylor (111) | answered Oct 13 '09, 10:38 a.m.
Thankyou very much, thats exactly what I needed. I had managed to get the getStste2() method working but could not find a way to convert this into the actual named values.

Thanks again for the help.

--
Regards
Jon
IBM


I also have several other attributes such as Category, ODC Impact and
a few others which I believe are custom ones. How do I go about
accessing the information contained within these fields since the
methods do not seem to be there to allow me to do this.

All attribute values, bot custom and built-in can be accessed using:

IAttribute attribute= workItemClient.findAttribute(projectArea,
IWorkItem.XY_PROPERTY_ID, monitor);
Object value= workItem.getValue(attribute);

The last one is the Status of the workItem, I need to be able to
return a String which contains the current Status of a workItem but I
cannot find a way to do this.

IWorkflowInfo info= workItemClient.findWorkflowInfo(workItem, monitor);
String name= info.getStateName(workItem.getState2());

--
Regards,
Patrick
Jazz Work Item Team

Your answer


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