Get timesheet attribute with RTC Java API
Accepted answer
As far as I remember that data was stored with a special reference/link. Can you have a look at https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/ or https://rsjazz.wordpress.com/2012/09/20/the-rtc-workitem-server-link-api-linking-to-work-items-and-other-elements/ and check,if you can use that code to find the specific links. I have no example at hand.
One other answer
Below is the code to get references on the Work Item :
IWorkItemReferences references = workingCopy.getReferences();
Of all the references, we are interested in the WORK_TIME end point references:
List <IReference> timesheets = references.getReferences(WorkItemEndPoints.WORK_TIME);
for each such reference, resolve the reference to a time sheet entry through the time sheet entry handle :
IItemReference timeSheetReference = (IItemReference) reference;
ITimeSheetEntryHandle timeSheetEntryHandle = (ITimeSheetEntryHandle) timeSheetReference.resolve();
ITimeSheetEntry tsEntry = (ITimeSheetEntry) mTeamRepository.itemManager().fetchCompleteItem(timeSheetEntryHandle, IItemManager.DEFAULT, mProgressMonitor);
Now, the tsEntry can be used to access various details on the entry like :
tsEntry.getHoursSpent()
tsEntry.getStartDate()
tsEntry.getCreator()
tsEntry.getTimeCode()
and so on...
IWorkItemReferences references = workingCopy.getReferences();
Of all the references, we are interested in the WORK_TIME end point references:
List <IReference> timesheets = references.getReferences(WorkItemEndPoints.WORK_TIME);
for each such reference, resolve the reference to a time sheet entry through the time sheet entry handle :
IItemReference timeSheetReference = (IItemReference) reference;
ITimeSheetEntryHandle timeSheetEntryHandle = (ITimeSheetEntryHandle) timeSheetReference.resolve();
ITimeSheetEntry tsEntry = (ITimeSheetEntry) mTeamRepository.itemManager().fetchCompleteItem(timeSheetEntryHandle, IItemManager.DEFAULT, mProgressMonitor);
Now, the tsEntry can be used to access various details on the entry like :
tsEntry.getHoursSpent()
tsEntry.getStartDate()
tsEntry.getCreator()
tsEntry.getTimeCode()
and so on...