我需要帮助才能从personInfo获取姓名和姓氏,我有来自用户的用户名。
我的代码是:
//get person from username
NodeRef person = personService.getPerson(username);
//error
PersonInfo personInfo = personService.getPerson(person);
String firstName = personInfo.getFirstName();
String lastName = personInfo.getLastName();
错误是:
java.lang.NoSuchMethodError: org.alfresco.service.cmr.security.PersonService.getPerson(Lorg/alfresco/service/cmr/repository/NodeRef;)Lorg/alfresco/service/cmr/security/PersonService$PersonInfo;
方法是:
我的错误在哪里?
Alfresco是版本4.2.c,alfresco-maven-sdk是1.1.1
提前致谢
答案 0 :(得分:3)
我没有正确的用于alfresco 4.2.c的SDK,它不包含上述方法。我找到了另一个解决方案:
NodeRef personRef = personService.getPerson(assignee);
String firstName = nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME).toString();
String lastName = nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME).toString();