It's all about the answers!

Ask a question

How to get username out of it's UUID ?


Yehiel Glass (25528986) | asked Sep 11 '12, 2:40 p.m.
Hello,
I'm writing a plugin.
I have the UUID of a user ( UUID wkspOwnerID = data.getSourceWorkspace().getOwner().getItemId(); )
, but I don't know how to get the username.
How can I do it?
Thanks.

5 answers



permanent link
Yehiel Glass (25528986) | answered Oct 15 '12, 2:33 p.m.
 HI I got the data:
/*********get user name*************************
IContributorHandle wkspOwnerhandle = (IContributorHandle) data.getSourceWorkspace().getOwner();   
IItem contributerHandle = itemService.fetchItem(wkspOwnerhandle, null);
IContributor userid = (IContributor) contributerHandle.getFullState();
String userName = userid.getName();
I did't use UUID but I got the userid of the wkspace owner on deliver operation - server side.
Regards,
Yehiel

permanent link
Yehiel Glass (25528986) | answered Oct 12 '12, 9:51 a.m.
edited Oct 12 '12, 9:52 a.m.
HI,

I tried but did't make it.

I'm using server side plugin and need to have the username/userid on  deliver action.

I thought I will make it like this:
String wkspOwner = data.getSourceWorkspace().getOwner().toString();
but it doesn't give the userid.

How can I get the userid out of the user UUID or how can I get the userid on deliver action (server side).

Need your assistance,
Yehiel


permanent link
Michele Pegoraro (1.8k12116103) | answered Sep 14 '12, 5:01 a.m.

For what I know you can obtain every object (like object handle) by UUID using Object.ITEM_TYPE.createItemHandle method.

for example: (IChangeSetHandle)IChangeSet.ITEM_TYPE.createItemHandle(uuid, null);


permanent link
sam detweiler (12.5k6191201) | answered Sep 12 '12, 9:24 p.m.
edited Sep 12 '12, 9:25 p.m.


the contributormanager is correct.

in the javadoc here is the api
fetchContributorRecordByIdentity(IContributorIdentity identity,

which returns the contributor record from the identity, which is a UUID

IContributorRecord.getName(); will return the name.


and the javadoc is in the download section

Sam

permanent link
Parker Dunton (4064) | answered Sep 12 '12, 12:55 p.m.
JAZZ DEVELOPER
If you're writing a client plugin, check out com.ibm.team.repository.client.IContributorManager. It looks like getting the user via UUID might be a pain, but if you can use a userId instead, that would be easier.

Your answer


Register or to post your answer.