-
1. Re: JBPM 4.3 Why is taskService.addTaskComment() only allowed for completed tasks?
sebastian.s Feb 1, 2010 10:28 AM (in response to ajonker)I have no answer for you and till now I was not aware that it was only possible for HistoryTasks. To me it makes perfectly sense to add comments to active tasks. Let's see what the developers say and if there is no specific reason for this you can go ahead and create a feature request afterwards. -
2. Re: JBPM 4.3 Why is taskService.addTaskComment() only allowed for completed tasks?
jbarrez Feb 2, 2010 5:09 PM (in response to ajonker)The logic that happens in the command is correct.
A history task is created together with the active task. The comment is attached to the historytask, to save a copy when the runtime task is deleted. If you use the API, there is no difference.
According to the test org.jbpm.test.task.TaskCommentsTest following the following is simply possible:
Task task = taskService.newTask();
String taskId = taskService.saveTask(task);
taskService.addTaskComment(taskId, "i'll clean up the mess");So I'm guessing your error must be elsewhere.
-
3. Re: JBPM 4.3 Why is taskService.addTaskComment() only allowed for completed tasks?
nick.bauman Feb 2, 2010 7:06 PM (in response to ajonker)1 of 1 people found this helpfulSeems like Joram's post pointing out the test reveals that the task has to be saved before comments work:
Task task = taskService.newTask();
String taskId = taskService.saveTask(task);
taskService.addTaskComment(taskId, "i'll clean up the mess");Arjan, your example seems to essentially have the last two lines of the test reversed:
taskService.addTaskComment(command.getTaskId(), command.getRemark());
taskService.completeTask(command.getTaskId(), command.getOutcome());
(assuming completeTask does a save)
-
4. Re: JBPM 4.3 Why is taskService.addTaskComment() only allowed for completed tasks?
sebastian.s Feb 3, 2010 2:48 AM (in response to jbarrez)Thanks for clarifying this, Joram. -
5. Re: JBPM 4.3 Why is taskService.addTaskComment() only allowed for completed tasks?
ajonker Feb 3, 2010 3:16 AM (in response to ajonker)Guys,
Thanx for your answers. It turned out I had a mistake in my configuration. The history session was not enabled, causing no HistostoryTask being created.
changing
<history-sessions/>
to
<history-sessions>
<object class="org.jbpm.pvm.internal.history.HistorySessionImpl" />
</history-sessions>fixed my problems.
Thanx again,
Arjan
-
6. Re: JBPM 4.3 Why is taskService.addTaskComment() only allowed for completed tasks?
kukeltje Feb 3, 2010 1:39 PM (in response to nick.bauman)It is not needed to save the task first normally. Joram does this in his example because he creates a task with
Task task = taskService.newTask();
Only after saving it you have an id which you normaly already have since the task is created by the engine and you retrieve it via the taskservice.