Alfresco - 在工作流程中获取用户名 [英] Alfresco - Get username in workflow

查看:24
本文介绍了Alfresco - 在工作流程中获取用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在工作流上创建时正在搜索 assignees 的用户名...

I'm searching for the username of assignees when I create on a workflow...

我用这个:

public void notify(DelegateExecution execution) {
    // get value of property mymodel:myproperty 
    Object assignees = execution.getVariable("bpm_assignees"); 
}

当我得到 bpm_assignees 时,我得到了这个:

When I get bpm_assignees I get this:

bpm_assignees 映射值:[节点类型:{alfresco.org/model/content/...} 人,节点方面:[{alfresco.org/model/content/…}拥有,{alfresco.org/model/system/1.0}可参考,{alfresco.org/model/system/1.0}localized],节点类型:{alfresco.org/model/content/...} 人,节点方面:[{alfresco.org/model/content/…}拥有,{alfresco.org/model/system/1.0}可参考,{alfresco.org/model/system/1.0}localized]]

bpm_assignees map value: [Node Type: {alfresco.org/model/content/…}person, Node Aspects: [{alfresco.org/model/content/…}ownable, {alfresco.org/model/system/1.0}referenceable, {alfresco.org/model/system/1.0}localized], Node Type: {alfresco.org/model/content/…}person, Node Aspects: [{alfresco.org/model/content/…}ownable, {alfresco.org/model/system/1.0}referenceable, {alfresco.org/model/system/1.0}localized]]

如何获取用户名?

推荐答案

那些对象是 Person NodeRefs.如果您从该节点取回属性,您将获得用户名、电子邮件地址等信息.您可以查看哪些属性可用 通过查看核心内容模型(向下滚动到 cm:person)

Those objects are the Person NodeRefs. If you fetch back the properties from that node, you'll get things like the user's username, email address etc. You can see what properties are available by looking at the core content model (scroll down to cm:person)

假设返回的对象是一个 ActivitiScriptNodeList,然后它们会很容易地用访问器等包裹起来,因为它们将是 ActivitiScriptNodes.那些扩展了普通的 Alfresco JavaScript ScriptNode 对象.这意味着您需要做的是:

Assuming the returned object is an ActivitiScriptNodeList, then they'll come handily wrapped up with accessors etc as they'll be ActivitiScriptNodes. Those extend the normal Alfresco JavaScript ScriptNode objects. That means that what you'd need to do is:

public void notify(DelegateExecution execution){
   ActivitiScriptNodeList assignees = execution.getVariable("bpm_assignees"); 
   for (ActivitiScriptNode personNode : assignees) {
       String username = personNode.getProperties().get("cm:userName");
       String email = personNode.getProperties().get("cm:email");
       // TODO Use this
   }
}

这篇关于Alfresco - 在工作流程中获取用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆