It's all about the answers!

Ask a question

Getting Time Spent by plain java API


Melanie Finke (7731520) | asked Mar 15 '12, 11:26 a.m.
Hello,

I try to get the time spent attribute by plain java API.

In IWorkItem is a getter for duration available, but this is the estimated time.

The id of time spent is according to the administration web interface timeSpent and of estimated time duration.

Is there a way to get the value of time spent through the plain java API?

Best regards

2 answers



permanent link
Melanie Finke (7731520) | answered Mar 19 '12, 7:32 a.m.
Hello,

in a earlier post I found a solution to my problem. https://jazz.net/forums/viewtopic.php?t=2379&highlight=spent

I tried the suggested way. If the attribute is not set I get -1 else 0 is returned. How can I get the concret value of time spent?

My code is:


IWorkItemCommon workItemCommon = (IWorkItemCommon) repository
.getClientLibrary(IWorkItemCommon.class);

IAttribute timeSpentattribute = workItemCommon.findAttribute(
projectArea, WorkItem.TIME_SPENT_PROPERTY, monitor);

Object o = rtcWorkItem.getValue(timeSpentattribute);



Best regards

permanent link
Melanie Finke (7731520) | answered Mar 21 '12, 9:54 a.m.
Hello,

I figured out, that it is not the code, that is wrong.

In the field time spent I do not type in the time I have already spent on that item. It is the time remaining. The program calculates estamated time - the in time spent typed in time and this is time spent in the attribute.

In my case estemated and time spent were always the same and I got 0.

Is the assumption of this behavior right and is it possible to type in time spent?

Best regards

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.