如何将候选用户列表传递给露天活动的激活工作流任务? [英] How do I pass a list of candidate users to an activiti workflow task in alfresco?

查看:176
本文介绍了如何将候选用户列表传递给露天活动的激活工作流任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够传递用户列表作为任务的候选人。用户是从数据列表中检索的,不能作为一个组使用。 Activiti:candidateUsers似乎是正确的方法。

I would like to be able to pass a list of users as candidates for a task. The users are retrieved from a data list and not available as a group. Activiti:candidateUsers would appear to be the right approach.

假定已获得用户并在变量ipw_reviwers中进行设置。

Assuming that the users have been obtained and set in the variable, ipw_reviwers.

<serviceTask id="alfrescoScripttask1" name="Alfresco Script Task" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
  <extensionElements>
    <activiti:field name="script">
      <activiti:string>logger.log("IPW - setup task");
      execution.setVariable('ipw_reviwers', "tom, dick, harry");</activiti:string>
    </activiti:field>
  </extensionElements>
</serviceTask>

以下使用变量ipw_reviewers

The following to uses the variable ipw_reviewers

<userTask id="adhocTask" name="Adhoc Task" activiti:candidateUsers="${ipw_reviewers}" activiti:formKey="wf:activitiReviewTask">
  <extensionElements>
    <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
      <activiti:field name="script">
        <activiti:string>logger.log("IPW - create task");
        if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
                  if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
      </activiti:field>
    </activiti:taskListener>
  </extensionElements>
</userTask>

没有人能够看到或声明任务。如果列表中只有一个用户,则该用户可以声明任务。

No one is able to see or claim the task. If there is only one user in the list, that user is able to claim the task.

如果将activiti:candidateUsers声明为

If activiti:candidateUsers is declared as

activiti:candidateUsers="tom, dick, harry"

然后所有三个用户都可以声明任务。

then all three users are able to claim the task.

可以将用户列表以变量形式传递给activiti:candidateUsers还是应该采用其他方法

Can a list of users be passed to activiti:candidateUsers in a variable or should a different approach be used?

推荐答案

已确认问题存在于 http://activiti.org ,然后从git repo中浏览activiti的来源,我搜索了activiti论坛。我遇到了,如果您想拥有多个候选用户,则必须使用Collection< String>此论坛上的变量 http://forums.activiti.org/en/viewtopic.php?f=6&t=3635&p=14187&hilit=candidateuser#p14187

Having confirmed that the problem existed activiti 5.10 from http://activiti.org and then trawled through the source of activiti from the git repo, I searched the activiti forums. I came across When you want to have multiple candidate users you'll have to use a Collection<String> variable on this forum http://forums.activiti.org/en/viewtopic.php?f=6&t=3635&p=14187&hilit=candidateuser#p14187.

我不知道如何执行。setVariableCollection< String>从javascript(有答案吗?),但使用groovy

I don't know how to execution.setVariable a Collection<String> from javascript (any answers?) but using groovy

List<String> users = [ 'tom', 'dick', 'harry'] as String[];
execution.setVariable('ipw_reviewers', users);

允许此任务

<userTask id="mytask" name="My Task" activiti:candidateUsers="${ipw_reviewers}">
</userTask>

根据需要工作。

当时在Alfresco中,我曾使用javascript从数据列表中查找用户列表,并将其放置在一个任务中,以逗号分隔的字符串中,然后在Groovy中执行脚本任务,该任务将字符串转换为List< String> ;准备在以下任务中使用。

For the time being in Alfresco, I have used used javascript to find the list of users from the data lists and placed them in a comma delimited string in one task and followed it with a script task in groovy that converts the string to a List<String> ready for use in the following tasks.

这篇关于如何将候选用户列表传递给露天活动的激活工作流任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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