Alfresco任务侦听器变量

编程入门 行业动态 更新时间:2024-10-25 22:30:39
本文介绍了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_new与count不同.

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任务侦听器变量

本文发布于:2023-11-28 10:23:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642015.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:侦听器   变量   Alfresco

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!