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

RTC 5.x - Mail config API

Hi All,
I have written API code to retrieve and update user's mail settings [RTC 5.0, RTC 5.0.2]. It has an issue - it is able to update only the users, for which i perform a manual save via user editor [*Edit any setting, save the user]
For new users, it retrieves existing mail config as null. [*Users which are not saved initially via editor]
Is any user-initialization or other settings required for this API to work? Please advise.

code is as follows:

                                user = icm.fetchContributorByUserId(userid, null);
                                contributorWorkingCopy = (IContributor) user.getWorkingCopy();                               
                                IContributorDetailsHandle detailsHandle = contributorWorkingCopy.getDetails();
                                details=(IContributorDetails) iim.fetchPartialItem(detailsHandle, IItemManager.REFRESH, Collections.singleton(IExtensibleItem.ALL_STATE_EXTENSIONS_PROPERTY),null);
                                details=(IContributorDetails) details.getWorkingCopy();
                                String mailconfig = details.getLargeStringExtension("com.ibm.team.workitem.mail.Configuration");
                               
For new users, which are not saved once via editor, mail config is retrieved as null. Please share any snippet that you have tried on 5.x or 5.0.x.

Thanks.

0 votes


Accepted answer

Permanent link
See:
https://jazz.net/forum/questions/100978/fetchcompleteitem-seems-not-to-help-solved
Apparently the details are null unless saved by a user.
Another code example.
https://jazz.net/forum/questions/137079/resolved-not-a-bug-with-user-mail-settings-and-receivemails

If you carefully search the SDK, you find this code:

try {
	IContributorDetails details = null;
	if (detailsHandle == null) {
		details = (IContributorDetails) IContributorDetails.ITEM_TYPE.createItem(repository);
		monitor.worked(200);
	} else {
		details = (IContributorDetails) repository.itemManager().fetchCompleteItem(detailsHandle, IItemManager.DEFAULT, new SubProgressMonitor(monitor, 200));
		details = (IContributorDetails) details.getWorkingCopy();
	}
The code creates new details, if there are none yet. This is done by this line: details = (IContributorDetails) IContributorDetails.ITEM_TYPE.createItem(repository);
VK L selected this answer as the correct answer

1 vote

Comments

yes, to help minimize storage consumption, the null value is meant to indicate the defaults should be used.  no point consuming a k or more per user to hold the same thing over and over.

1 vote

Hi Ralph,
IContributorDetailsHandle detailsHandle = contributorWorkingCopy.getDetails();

detailsHandle is not null in my case. It has a value like:
com.ibm.team.repository.common.model.impl.ContributorDetailsHandleImpl@f2a0abc9 (stateId: <unset>, itemId: [UUID _Of0uIrHdEeS2qYoOw5bhsg], origin: com.ibm.team.repository.client.internal.TeamRepository@29087730, immutable: true)

However, mail config is retrieved as null. Please advise.

see my prior comment, save space, null = use defaults

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

Question asked: Feb 11 '15, 7:00 a.m.

Question was seen: 2,704 times

Last updated: Feb 11 '15, 9:02 a.m.

Confirmation Cancel Confirm