Java jBPM 6.2-完成任务时无法添加注释

Java jBPM 6.2-完成任务时无法添加注释,java,jbpm,Java,Jbpm,我无法在完成任务时向任务添加注释。在jBPM 5中,TaskClient中有一个名为“addComment”的方法。如何在jBPM 6.2中添加任务。以下是我试图做的: Comment taskComment = new CommentImpl(); Map<String, Object> params = new HashMap<String, Object>(); //params.put("Comment", actorId+" completed the task

我无法在完成任务时向任务添加注释。在jBPM 5中,TaskClient中有一个名为“addComment”的方法。如何在jBPM 6.2中添加任务。以下是我试图做的:

Comment taskComment = new CommentImpl();
Map<String, Object> params = new HashMap<String, Object>();
//params.put("Comment", actorId+" completed the task#"+taskId);
params.put("assignedTo", user.getUsername());
params.put("description", documentUUID);

workflowUtil.completeTask(taskId, actorId, params);
Task task=workflowUtil.getTask(taskId);
task.getTaskData().getComments().add(taskComment) ;
Comment taskComment=new CommentImpl();
Map params=新的HashMap();
//params.put(“Comment”,actorId+“已完成任务”#“+taskId);
参数put(“assignedTo”,user.getUsername());
参数put(“说明”,documentUUID);
workflowUtil.completeTask(taskId、actorId、params);
Task Task=workflowUtil.getTask(taskId);
task.getTaskData().getComments().add(taskComment);

我应该怎么做才能保留此注释以便以后检索。

taskservice或内部taskservice正在提供该方法,因此您应该能够像在completeTask方法中一样进行操作。

您可以
添加
,使用
TaskService.execute()
为任务删除
getallcomments
,如下所示:

org.kie.api.task.TaskService taskService = runtimeEngine.getTaskService();
taskService.execute(new AddCommentCommand(taskId, comment));
taskService.execute(new DeleteCommentCommand(taskId, comment));
taskService.execute(new GetAllCommentsCommand(taskId));