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

Get timesheet attribute with RTC Java API

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. 

0 votes


Accepted answer

Permanent link
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

0 votes


One other answer

Permanent link
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...

2 votes

Comments

Thanks for sharing Dinesh!

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

Question asked: Nov 25 '13, 1:21 p.m.

Question was seen: 6,008 times

Last updated: Aug 14 '14, 9:37 a.m.

Confirmation Cancel Confirm