繁体   English   中英

Alfresco-在工作流程中获取用户名

[英]Alfresco - Get username in workflow

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

我用这个:

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

当我得到bpm_assignees我得到了:

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

如何获得username

这些对象是Person NodeRefs。 如果从该节点取回属性,则会得到诸如用户的用户名,电子邮件地址等信息。您可以通过查看核心内容模型来查看可用属性(向下滚动至cm:person)

假设返回的对象是ActivitiScriptNodeList ,则它们将被访问器等方便地包装起来,因为它们将是ActivitiScriptNode 这些扩展了常规的Alfresco JavaScript ScriptNode对象 这意味着您需要做的是:

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
   }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM