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

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

问题描述

在工作流程上创建时,我正在搜索代理人的用户名...



I使用此命令:

  public void notify(DelegateExecution execute){
//获取属性mymodel:myproperty $ b的值$ b对象分配者= 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/…}person,节点方面:
[{alfresco.org/model/content/…}拥有,
{alfresco.org/model/system/1.0}可引用,
{alfresco.org/model/system/1.0}已本地化]]


如何获取用户名

解决方案

这些对象是Person NodeRefs。如果从该节点取回属性,则会得到诸如用户的用户名,电子邮件地址等信息。您可以看到可用的属性(向下滚动到cm:person)打开镜像/alfresco/HEAD/root/projects/repository/config/alfresco/model/contentModel.xml rel = nofollow> / p>

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

  public void notify(DelegateExecution execute){
ActivitiScriptNodeList分配者= execution.getVariable( bpm_assignees);
(ActivitiScriptNode personNode:受让人){
字符串username = personNode.getProperties()。get( cm:userName);
字符串email = personNode.getProperties()。get( cm:email);
// TODO使用此
}
}


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

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

How can I get username?

解决方案

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)

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天全站免登陆