It's all about the answers!

Ask a question

Unable to get the logged in user details


Mahesh Vasamsetti (176) | asked Aug 03 '15, 1:51 a.m.
Please check below code:

IContributor contributor = repo.contributorManager().fetchContributorByUserId(selectedUser, null); 
IProcessItemService service = (IProcessItemService) repo.getClientLibrary(IProcessItemService.class); 
IClientProcess clientProcess = service.getClientProcess(Teamarea, monitor); 
IRole[] availableRoles = clientProcess.getContributorRoles(contributor, Teamarea, null);

In the above code 
1. how to get the logged in user details (userid and user name) ??
2. How to create repo object ??

One answer



permanent link
Ralph Schoon (63.6k33647) | answered Aug 03 '15, 2:14 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
See https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ and other articles there.

System.out.println("Logged in as: "
			+ teamRepository.loggedInContributor().getName());



Comments
Mahesh Vasamsetti commented Aug 03 '15, 2:20 a.m. | edited Aug 03 '15, 4:36 a.m.

 Thank you Ralph Schoon for your quick response.


I am not able to create teamRepository object. Please help me how to create this object. FYI,I am using RTC server API but not RTC client API

Regards,
Mahesh


Ralph Schoon commented Aug 03 '15, 4:41 a.m. | edited Aug 03 '15, 4:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You don't crate it, you get it.

I would strongly recommend to read this post https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ it explains how to get the ITeamRepository from the TeamPlatform. You can also look into the links there and you can look into the snippets that come with the PlainJavaClientLibraries.

The same question came up some days ago and the same suggestion was made.


Ralph Schoon commented Aug 03 '15, 4:54 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Alternatively you can read https://jazz.net/library/article/1229


Mahesh Vasamsetti commented Aug 05 '15, 12:54 a.m.

  Thank you.


I am now getting below error:

ERROR: com.ibm.team.repository.common.NotLoggedInException: CRJAZ1244I Not logged in to the repository at URL "https://localhost:7443/jazz/". 


Ralph Schoon commented Aug 05 '15, 4:19 a.m. | edited Aug 05 '15, 4:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am sorry, but if you don't follow the links suggested above and don't educate yourself e.g. by going to the Plain Java client Library snippets and trying to understand the basics of how this works, there is little forum members will be able to do to help you.



Ralph Schoon commented Aug 05 '15, 4:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If you are not logged into the TeamRepository with a user, you can quite obviously not get the logged in user.

showing 5 of 6 show 1 more comments

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.