I need help to get the name and surname from personInfo, I have username from user.
My code is:
//get person from username
NodeRef person = personService.getPerson(username);
//error
PersonInfo personInfo = personService.getPerson(person);
String firstName = personInfo.getFirstName();
String lastName = personInfo.getLastName();
error is:
java.lang.NoSuchMethodError: org.alfresco.service.cmr.security.PersonService.getPerson(Lorg/alfresco/service/cmr/repository/NodeRef;)Lorg/alfresco/service/cmr/security/PersonService$PersonInfo;
method is:
Where's my mistake?
Alfresco is version 4.2.c, alfresco-maven-sdk is 1.1.1
Thanks in advance
I didn't have right SDK for alfresco 4.2.c, that not containt above method. I found anatoher solution:
NodeRef personRef = personService.getPerson(assignee);
String firstName = nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME).toString();
String lastName = nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME).toString();