简体   繁体   English

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

[英]Alfresco - Get username in workflow

I'm searching for the username of assignees when I create on a workflow... 我在工作流程上创建时正在搜索assignees的用户名...

I use this: 我用这个:

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

When I get bpm_assignees I get this: 当我得到bpm_assignees我得到了:

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]] 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}已本地化]]

How can I get username ? 如何获得username

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

Assuming the returned object is an ActivitiScriptNodeList , then they'll come handily wrapped up with accessors etc as they'll be ActivitiScriptNode s. 假设返回的对象是ActivitiScriptNodeList ,则它们将被访问器等方便地包装起来,因为它们将是ActivitiScriptNode Those extend the normal Alfresco JavaScript ScriptNode objects . 这些扩展了常规的Alfresco JavaScript ScriptNode对象 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
   }
}

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

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