How to save user's absence information programmatically?
Hello,
I want to save user's absence information programmatically. It seems to refer to IContributorAbsence , ContributorAbsence or OutOfOfficeItem. However, I don`t know how to use them. Could anyone professional help me? :?: |
7 answers
I want to save user's absence information programmatically. You can create absences programatically similar to the following snippet. Note that this is internal API and is subject to change at any time without notice. Timestamp startDate= null; Timestamp endDate= null; IContributor owner; ITeamRepository teamRepository; IResourcePlanningClient resourcePlanningClient= (IResourcePlanningClient) teamRepository.getClientLibrary(IResourcePlanningClient.class); ContributorAbsence absence= (ContributorAbsence) IContributorAbsence.ITEM_TYPE.createItem(); absence.setSummary("My Summary"); absence.setStartDate(startDate); absence.setEndDate(endDate); absence.setContributor(owner); resourcePlanningClient.saveAbsences(new ContributorAbsence[] { absence }, new SubProgressMonitor(monitor, 1)); -- MikeS Jazz Agile Planning team |
I haven't tried it, but thanks a lot first. i will tell you my result later.
|
I have tried the snippet, but I met two problems. One is it can not find IResourcePlanningClient class, and the other is it seems that internal classes can not be accessed when it is compiled.
Could you explain it more in details? Thank you again. I want to save user's absence information programmatically. You can create absences programatically similar to the following snippet. Note that this is internal API and is subject to change at any time without notice. Timestamp startDate= null; Timestamp endDate= null; IContributor owner; ITeamRepository teamRepository; IResourcePlanningClient resourcePlanningClient= (IResourcePlanningClient) teamRepository.getClientLibrary(IResourcePlanningClient.class); ContributorAbsence absence= (ContributorAbsence) IContributorAbsence.ITEM_TYPE.createItem(); absence.setSummary("My Summary"); absence.setStartDate(startDate); absence.setEndDate(endDate); absence.setContributor(owner); resourcePlanningClient.saveAbsences(new ContributorAbsence[] { absence }, new SubProgressMonitor(monitor, 1)); -- MikeS Jazz Agile Planning team |
I have tried the snippet, but I met two problems. One is it can not you need to add a dependency to the com.ibm.team.apt.client bundle. because the API is internal and not exported, you must set the respective compile problem as warning rather than error -- MikeS Jazz Agile Planning team |
Thank you for your reply. I have partly solved the problem.
|
Hi Michael,
Does this solution is still valid for RTC 3.0? Thanks, Best Regards, Dominique I want to save user's absence information programmatically. You can create absences programatically similar to the following snippet. Note that this is internal API and is subject to change at any time without notice. Timestamp startDate= null; Timestamp endDate= null; IContributor owner; ITeamRepository teamRepository; IResourcePlanningClient resourcePlanningClient= (IResourcePlanningClient) teamRepository.getClientLibrary(IResourcePlanningClient.class); ContributorAbsence absence= (ContributorAbsence) IContributorAbsence.ITEM_TYPE.createItem(); absence.setSummary("My Summary"); absence.setStartDate(startDate); absence.setEndDate(endDate); absence.setContributor(owner); resourcePlanningClient.saveAbsences(new ContributorAbsence[] { absence }, new SubProgressMonitor(monitor, 1)); -- MikeS Jazz Agile Planning team |
Bryan Miller - Integration Developer (449●35●31)
| answered May 13 '14, 5:49 p.m.
edited May 14 '14, 10:38 a.m.
It is still valid for 3.x and 4.x. It is not straightforward to use however. Caveat machinator!
|
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.