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

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? :?:

0 votes



7 answers

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

0 votes


Permanent link
I haven't tried it, but thanks a lot first. i will tell you my result later.

0 votes


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

0 votes


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

0 votes


Permanent link
Thank you for your reply. I have partly solved the problem.

0 votes


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

0 votes


Permanent link
It is still valid for 3.x and 4.x.  It is not straightforward to use however.  Caveat machinator!

0 votes

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

Question asked: Apr 16 '09, 6:17 a.m.

Question was seen: 8,248 times

Last updated: May 14 '14, 10:38 a.m.

Confirmation Cancel Confirm