It's all about the answers!

Ask a question

How to save user's absence information programmatically?


Xin Li (161) | asked Apr 16 '09, 6:17 a.m.
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



permanent link
Michael Scharf (781) | answered Apr 17 '09, 2:21 a.m.
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? :?:

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

permanent link
Xin Li (161) | answered Apr 20 '09, 8:38 a.m.
I haven't tried it, but thanks a lot first. i will tell you my result later.

permanent link
Xin Li (161) | answered Apr 20 '09, 9:34 a.m.
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.

It seems to refer to IContributorAbsence , ContributorAbsence or
OutOfOfficeItem.

However, I don`t know how to use them. Could anyone professional help
me? :?:

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

permanent link
Michael Scharf (781) | answered Apr 21 '09, 5:15 a.m.
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.

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

permanent link
Xin Li (161) | answered Apr 23 '09, 2:54 a.m.
Thank you for your reply. I have partly solved the problem.

permanent link
Dominique BERTRAND (611) | answered Apr 06 '12, 4:32 a.m.
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.

It seems to refer to IContributorAbsence , ContributorAbsence or
OutOfOfficeItem.

However, I don`t know how to use them. Could anyone professional help
me? :?:

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

permanent link
Bryan Miller - Integration Developer (4493531) | 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


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.