Is it possible to access "Time Tracking" sheet using Plain java API to set values?
Accepted answer
One other answer
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
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]