Alfresco:从人名获得名字和姓氏

时间:2014-07-02 12:03:10

标签: alfresco-share

我需要帮助才能从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;

方法是:

enter image description here

我的错误在哪里?

Alfresco是版本4.2.c,alfresco-maven-sdk是1.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();