How can I get the current user name as logged in user
chen fengmiao (70●3●29●32)
| asked Dec 13 '13, 11:09 p.m.
edited Apr 15 '14, 2:54 a.m. by Ralph Schoon (63.4k●3●36●46) this my java code: package org.example.attributecustomization; import org.eclipse.core.runtime.IProgressMonitor;
import com.ibm.team.repository.common.TeamRepositoryException;
public class MySecondValueProvider implements IValueProvider<String> {
}
I want to get the current user name ,but these code only get the user's UUID. How can I do? Thank you! |
3 answers
You might also poke around at what methods are available on your return statement. When you have an IContributor, you can access the getUserId() method. If getUser() gets you an IContributor object, you might be able to do something like workItemCommon.getAuditableCommon().getUser().getUserId()
Comments
chen fengmiao
commented Dec 16 '13, 8:21 a.m.
Hi, Lauren Hayward Schaefer, I want to get the user's name ,not the user's id,what can I do? IContributor also has a getName() method. If getUser() gets you an IContributor object, I'd try workItemCommon.getAuditableCommon().getUser().getName().
chen fengmiao
commented Dec 16 '13, 8:33 a.m.
Hi ,Lauren Hayword Schaefer, Thank your answer. but I don't find your provide method.
What type is getUser() returning?
chen fengmiao
commented Dec 16 '13, 10:08 a.m.
return IContributorHandle
Lauren Hayward Schaefer
commented Dec 16 '13, 11:02 a.m.
| edited Dec 16 '13, 11:03 a.m.
JAZZ DEVELOPER
I think what you'll need to do is use the IContributorHandle to get the IContributor and then you can call getUser(). I'm not sure if you'll have access to these particular api's, but you should be able to do something along the lines of the following to get your IContributor:
chen fengmiao
commented Dec 16 '13, 11:23 a.m.
Hi,Lauren Hayward Schaefer, the method "getService(IRepositoryItemService.class); " how can I get it?
It need implement which interface or extend which class?
Check out this forum post for more info how to fetch items: https://jazz.net/forum/questions/69960/how-to-use-getcreator
showing 5 of 8
show 3 more comments
|
hm.. on the ITeamRepository class
on the IConfiguration class
Comments
chen fengmiao
commented Dec 16 '13, 11:28 a.m.
Hi,sam detweiler, You see I don't find the method teamRepository():
chen fengmiao
commented Dec 17 '13, 8:29 a.m.
Hi,sam detweiler, where can I find your provide API method? And How I get rtc api document?Please help me ,thank you!
sam detweiler
commented Dec 17 '13, 10:37 a.m.
I used the javadoc which is available as part of the rtc product downloads.
your extension also should extend the AbstractService class
|
Ralph Schoon (63.4k●3●36●46)
| answered Dec 17 '13, 9:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
See https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ for how to use the Eclipse PDE and the SDK for searching. Although described for the client, it works the same for the server SDK. See https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/ for how to setup the SDK.
You need to code like private IContributor getContributorFromHandle(IContributorHandle handle) throws TeamRepositoryException{ return (IContributor) fRepositoryItemService.fetchItem(handle, IRepositoryItemService.COMPLETE); } fRepositoryItemService=getService(IRepositoryItemService.class); Not sure if I have an example here, but: https://rsjazz.wordpress.com/2012/11/30/a-create-approval-work-item-save-participant/ shows some of the code. You get getService by extending AbstractService. Comments
chen fengmiao
commented Dec 17 '13, 9:48 a.m.
Hi, Ralph Schoon,
Why I don't open same page on the rsjazz.workpress.com,like:
or
Ralph Schoon
commented Dec 17 '13, 10:06 a.m.
| edited Dec 17 '13, 10:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
If you are in China and potentially some other countries, Wordpress is banned - by the government. I have readers from China, but they apparently use a VPN or other solution to get to what they are not supposed to be getting at.
chen fengmiao
commented Dec 17 '13, 10:14 a.m.
Hi, Ralph Schoon,
I don't open the page :
https://rsjazz.wordpress.com/2012/11/30/a-create-approval-work-item-save-participant/ in China.
Could you send this page's content to my email:chenfengmiao@sina.cn
Thanks a lot!
Ralph Schoon
commented Dec 17 '13, 10:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I sent you a couple of compressed articles.
chen fengmiao
commented Dec 17 '13, 11:21 a.m.
I already receive your email,Thanks a lot! |
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.
Comments
configuration.teamRepository().getUserId()
Hi,sam detweiler,
I don't find the method: