It's all about the answers!

Ask a question

Get timesheet attribute with RTC Java API


Tayane Fernandes (251216) | asked Nov 25 '13, 1:21 p.m.
Hi,
I want to get each timesheet entry of all tasks per day using the Java API. 
I could not find an example of how to do this.

Someone would know how to do this?

Thanks in advance. 

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Nov 26 '13, 10:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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.
Tayane Fernandes selected this answer as the correct answer

One other answer



permanent link
Dinesh Kumar B (4.1k413) | answered Aug 14 '14, 8:36 a.m.
JAZZ DEVELOPER
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...

Comments
Ralph Schoon commented Aug 14 '14, 9:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Thanks for sharing Dinesh!

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.