Alfresco任务侦听器变量 [英] Alfresco task listener variables

查看:112
本文介绍了Alfresco任务侦听器变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个任务侦听器,第一个在event="create"上,第二个在event="complete"上. 在第一个中,我在创建任务时对文件进行计数,在第二个中,在任务完成时对文件进行计数,并查看文件数是否相等,从而引发错误.但这不起作用,我有ReferenceError: "count" is not defined.

I have two task listeners,the first on event="create" the second on event="complete". In the first i'm counting files when task was created, in the second when task completed and looking if the number of files is equal throw an error. But this not work, i have ReferenceError: "count" is not defined.

<extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[
               var count = 0;
               for (var i = 0; i < bpm_package.children.length; i++) 
                {
                  count++;
                }
        ]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>

        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[
               var count_new = 0;
               for (var i = 0; i < bpm_package.children.length; i++) 
                {
                  count_new++;
                }
                if (count ==count_new)
                 {
                    var message = "\n\nAdd files\n";
                    throw new Error(message + "\n");
                 }
    ]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>

推荐答案

我解决了如何定义变量的问题.您需要将execution.setVariable ('zvernennya_count', count);添加到第一个任务侦听器.

I solved the problem of how to define a variable. You need to add execution.setVariable ('zvernennya_count', count); to the first task listener.

但是它不能解决我测试附件的问题,因为变量count定义一次,并且该任务具有多用户访问权限,并且当第一个用户任务完成时,下一个用户任务已经具有变量count_newcount不同.

But it does not solve my problem of testing attachments, because the variable count is defined once, and the task has multi-user access, and when the first users task is completed, the next users task already has variable count_new different from count.

这篇关于Alfresco任务侦听器变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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