当我在工作流程上创建时,我正在搜索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/...}person,Node Aspects: [{alfresco.org/model/content/...}ownable, {alfresco.org/model/system/1.0}referenceable, {alfresco.org/model/system/1.0}localized],节点类型: {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]
我如何获得username
?
答案 0 :(得分:3)
这些对象是Person NodeRefs。如果您从该节点获取属性,您将获得用户的用户名,电子邮件地址等内容。您可以看到可用的属性by looking at the core content model(向下滚动到cm:person)
假设返回的对象是ActivitiScriptNodeList,那么它们将会轻易地包含访问器等,因为它们将是ActivitiScriptNode。这些扩展了正常的Alfresco JavaScript ScriptNode objects。这意味着你需要做的是:
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
}
}