cancel
Showing results for 
Search instead for 
Did you mean: 

How to get LockOwner's full name?

ddong
Champ in-the-making
Champ in-the-making
Hi, I just wondering is there any way to get the full name of a lockowner?
As a the username of a lockowner can be obtained by using the following code in the Node class:

Object obj = getProperties().get(ContentModel.PROP_LOCK_OWNER);

So is there any method using username to get the fullname of that user? I saw a method named "getPerson(String userName)" in the PersonServiceImp class, so is it possible to use this? I really feel confusing about the search mechnism used in Alfresco.
3 REPLIES 3

kevinr
Star Contributor
Star Contributor
Yes you can use the PersonService to get the Person node that represents that username. Then you can get the properties from that node such as "cm:firstName" and "cm:lastName" to build up the full name string.

Thanks,

Kevin

ddong
Champ in-the-making
Champ in-the-making
Thanks, Kevin.

I am just wondering how can I reference the PersonService in the Node class? or need I to construct a new PersonService instance?

kevinr
Star Contributor
Star Contributor
In the web-client, 99% of the public services can be obtained through the ServiceRegistry, which is obtained via the client Repository static helper class. You will see the pattern used quite a bit in client code, but not in the JSF beans (which use Spring injection of the specific services). So in the Node class there is already a helper to get the ServiceRegistry, just call:
getServiceRegistry().getPersonService()

Thanks.

Kevin