It's all about the answers!

Ask a question

How to change the value of Attributes Time Spent etc?


Christopher Zuendorf (6162) | asked Oct 09 '08, 3:06 a.m.
Hello Jazz Team,

how can I change the values of the attributes Time Spent and Corrected with help of a plain Java Program? Any ideas? I know how to change the value of estimated time, but there is no method to change Time Spent.

Greetz Christopher Zuendorf

8 answers



permanent link
Patrick Streule (4.9k21) | answered Oct 09 '08, 11:42 a.m.
JAZZ DEVELOPER
how can I change the values of the Attributes Time Spent and Corrected
with help of a plain Java Program? Any ideas? I know how to change
the value of estimated time, but there is no method to change Time
Spent.

You could use the generic setValue API on IWorkItem:

IAttribute timeSpentAttribute= workItemClient.findAttribute(projectArea,
WorkItem.TIME_SPENT_PROPERTY, monitor);
workingCopy.setValue(timeSpentAttribute, timeSpent);

HTH,
Patrick
Jazz Work Item Team

permanent link
Christopher Zuendorf (6162) | answered Oct 22 '08, 8:43 a.m.
It works! THX.

permanent link
Eduardo Bello (4401922) | answered Oct 27 '10, 10:24 a.m.
I'm using RTC 2.0, and there isn't IWorkItem.TIME_SPENT_PROPERTY. I only found IWorkItem.DURATION_PROPERTY.

Is it the same?

I try to use:


IItem item = workItem.getFullState();
if (item instanceof WorkItemImpl) {
WorkItemImpl wii = (WorkItemImpl) item;
long timeSpent = wii.getTimeSpent();
}


But it gives warning of "Discouraged access: The type WorkItemImpl is not accessible due to restriction on required library".

So, how can I get TimeSpent programmatically inside a Participant?

permanent link
Eduardo Bello (4401922) | answered Nov 04 '10, 4:53 p.m.
Anyone?

permanent link
Patrick Streule (4.9k21) | answered Nov 08 '10, 6:38 a.m.
JAZZ DEVELOPER
I'm using RTC 2.0, and there isn't IWorkItem.TIME_SPENT_PROPERTY. I
only found IWorkItem.DURATION_PROPERTY.

Is it the same?

I try to use:


IItem item = workItem.getFullState();
if (item instanceof WorkItemImpl) {
WorkItemImpl wii = (WorkItemImpl) item;
long timeSpent = wii.getTimeSpent();
}


But it gives warning of "Discouraged access: The type
WorkItemImpl is not accessible due to restriction on required
library".

So, how can I get TimeSpent programmatically inside a Participant?

The pattern for getting work item attributes is always:

IAttribute attribute= workItemCommon.findAttribute(projectArea,
attributeId, monitor);

Object value= workItem.getValue(attribute);

--
Regards,
Patrick
RTC Work Item Component Lead

permanent link
Eduardo Bello (4401922) | answered Nov 09 '10, 9:32 a.m.
I'm using RTC 2.0, and there isn't IWorkItem.TIME_SPENT_PROPERTY. I
only found IWorkItem.DURATION_PROPERTY.

Is it the same?

I try to use:


IItem item = workItem.getFullState();
if (item instanceof WorkItemImpl) {
WorkItemImpl wii = (WorkItemImpl) item;
long timeSpent = wii.getTimeSpent();
}


But it gives warning of "Discouraged access: The type
WorkItemImpl is not accessible due to restriction on required
library".

So, how can I get TimeSpent programmatically inside a Participant?

The pattern for getting work item attributes is always:

IAttribute attribute= workItemCommon.findAttribute(projectArea,
attributeId, monitor);

Object value= workItem.getValue(attribute);

--
Regards,
Patrick
RTC Work Item Component Lead

Ok, but where can I find time spent, estimated and corrected attributes IDs?

permanent link
Patrick Streule (4.9k21) | answered Nov 10 '10, 4:53 a.m.
JAZZ DEVELOPER
Ok, but where can I find time spent, estimated and corrected
attributes IDs?

com.ibm.team.workitem.common.internal.model.WorkItem.CORRECTED_ESTIMATE_PROPERTY
com.ibm.team.workitem.common.internal.model.WorkItem.TIME_SPENT_PROPERTY
com.ibm.team.workitem.common.model.IWorkItem.DURATION_PROPERTY

--
Regards,
Patrick
RTC Work Item Component Lead

permanent link
Eduardo Bello (4401922) | answered Nov 10 '10, 7:14 a.m.
Ok, but where can I find time spent, estimated and corrected
attributes IDs?

com.ibm.team.workitem.common.internal.model.WorkItem.CORRECTED_ESTIMATE_PROPERTY
com.ibm.team.workitem.common.internal.model.WorkItem.TIME_SPENT_PROPERTY
com.ibm.team.workitem.common.model.IWorkItem.DURATION_PROPERTY

--
Regards,
Patrick
RTC Work Item Component Lead

Thank you! That will be very useful...

If you don't mind, I have just one little doubt... Why CORRECTED_ESTIMATE_PROPERTY and TIME_SPENT_PROPERTY isn't at IWorkItem like the others attributes Ids?

Anyway, thank you again.

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.