【问题标题】:Move an attached to a task document to another node将附加到任务文档的附件移动到另一个节点
【发布时间】:2018-11-15 13:28:20
【问题描述】:

向社区致敬,我正在使用 alfresco 6.0.0 社区版,我想在任务完成时将附加到任务的文档移动到另一个节点。

我从这里https://community.alfresco.com/thread/204737-workflow-parallel-group-review-with-move 发现了这个“移动”功能,所以我目前正在做的事情如下:

  1. 开始进程
  2. 将项目附加到我使用
  3. 创建的任务

/tasks/{taskId}/items (POST) alfresco REST API 的方法。

  1. 完成任务

我移动文件的 bpmn 部分如下:

<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
              <activiti:field name="script">
                 <activiti:string> 

                   java.lang.System.out.println(bpm_package.children.length);
                    for (var i = 0; i &lt; bpm_package.children.length; i++){
                     bpm_package.children.move("b162be92-fb36-44f0-83c1-4432b8261c5a");
                    }
                 </activiti:string>
              </activiti:field>
           </activiti:taskListener>

其中 b162be92-fb36-44f0-83c1-4432b8261c5a 是我创建的文件夹的节点 ID。

不幸的是,当我完成此任务时,我收到以下错误:

节点类型:{http://www.alfresco.org/model/content/1.0}内容,节点方面:[{http://www.alfresco.org/model/content/1.0}可审核,{http://www.alfresco.org/model/system/1.0}可参考,{http://www.alfresco.org/model/system/1.0}本地化] 0.0 2018-11-15 15:43:24,936 错误 [impl.interceptor.CommandContext] [http-apr-8080-exec-3] 关闭命令上下文时出错 org.activiti.engine.ActivitiException:调用TaskListener时出现异常:调用TaskListener时出现异常:10150807无法执行提供的脚本:10150806 TypeError:无法在对象中找到函数移动节点类型:{http://www.alfresco.org/model/content/1.0}内容,节点方面:[{@ 987654327@}可审计,{http://www.alfresco.org/model/system/1.0}可参考,{http://www.alfresco.org/model/system/1.0}本地化]。 (AlfrescoJS#10) 在 org.activiti.engine.impl.persistence.entity.TaskEntity.fireEvent(TaskEntity.java:742) 在 org.activiti.engine.impl.persistence.entity.TaskEntity.complete(TaskEntity.java:184) 在 org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:52) 在 org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:24) 在 org.activiti.engine.impl.cmd.NeedsActiveTaskCmd.execute(NeedsActiveTaskCmd.java:59) 在 org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24) 在 org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57) 在 org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47) 在 org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) 在 org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45) 在 org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31) 在 org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40) 在 org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35) 在 org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:178) 在 org.alfresco.rest.workflow.api.impl.TasksImpl.update(TasksImpl.java:821) 在 sun.reflect.GeneratedMethodAccessor1556.invoke(未知来源) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在 java.lang.reflect.Method.invoke(Method.java:498)

请问有人能解释一下吗?非常感谢任何帮助:)

【问题讨论】:

    标签: java workflow alfresco activiti bpmn


    【解决方案1】:

    已解决

    问题在于 move 函数需要一个节点元素,而不是我传递给它的 id(字符串)。

    下面的固定代码:

    <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
              <activiti:field name="script">
                 <activiti:string> 
                    for (var i = 0; i &lt; bpm_package.children.length; i++){
                     var p = bpm_package;
                     var doc = p.children[i];
                     var myNode = initiatorhome.childByNamePath("foldertomove/testFolder"); <!-- the names of the nodes under the root directory where the file should be moved to-->
                     doc.move(myNode); 
                    }
                 </activiti:string>
              </activiti:field>
           </activiti:taskListener>
    

    【讨论】:

      猜你喜欢
      • 2019-07-19
      • 1970-01-01
      • 2023-02-02
      • 1970-01-01
      • 1970-01-01
      • 2012-10-16
      • 2018-12-06
      • 2019-08-15
      • 1970-01-01
      相关资源
      最近更新 更多