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

Is it possible to access "Time Tracking" sheet using Plain java API to set values?

Is it possible to set values to "Time tracking" in Task via Plan Java API?
Time tracking
If so can someone point to the correct API?

Thanks




1 vote


Accepted answer

Permanent link
For anyone who searches for example, I created example code to access and modify the time tracking data for work items and published in this post: https://rsjazz.wordpress.com/2015/03/31/the-work-item-time-tracking-api/
Karthik Krishnan selected this answer as the correct answer

2 votes


One other answer

Permanent link
Karthik,

I doubt it would be in the Plain Java API. If you load the published RTC SDK however and Java Search for TimeSheet, the com.ibm.team.rtc.reports.service.test has a class BaseRTCReportTest.
There is a method: createTimesheetEntry that has sample code.  I would have guessed that some parts of it probably rely on internal API but so far I have not found anything. Seems to be all legit parts of the published RTC SDK.

Core method:
with: IWorkItemService workItemService
ITimeSheetEntry entry = workItemService.createTimeSheetEntry(projectArea);


If this is helpful please mark this answer accepted.
Thanks,
Arne

1 vote

Comments

Hello Arne,
Thanks for the hint, we tried with below code snippet but it's not working.
 
ITimeSheetEntry entry = workItemClient. createTimeSheetEntry(projectArea);       
entry.setTimeSpent(new Duration(1000L6060));
entry.setTimeCodeId("timecode.literal.l2"); entry.setStartDate(Timestamp.valueOf("2014-06-20 20:30:00"));
entry.setCreator(workItem.getOwner());           

IWorkItemReferences copyReferences = workItemWorkingCopyManager.getReferences();
IItemReference timesheetRef = IReferenceFactory.INSTANCE.createReferenceToItem(entry);
copyReferences.add(WorkItemEndPoints.WORK_TIME, timesheetRef);
workItemWorkingCopyManager.getDependentItems().add(entry);

Exception occurs at the last line [workItemWorkingCopyManager.getDependentItems().add(entry);], We even tried skipping this (no exceptions but value is not saved)

com.ibm.team.repository.common.validation.PropertyConstraintException: Validation errors for item: type = TimeSheetEntry, itemId = [UUID _flFMcP0TEeOc05tOqOHMlw]

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

Question asked: Jun 25 '14, 9:39 a.m.

Question was seen: 5,347 times

Last updated: Mar 31 '15, 10:42 a.m.

Confirmation Cancel Confirm