-
1. Re: task-node attribute create-tasks
arjunbalraj Aug 7, 2007 5:16 PM (in response to warfster)If i understand this right, when you specify the create-tasks attribute for a task node in the process defintion, it automatically creates a taskinstance when the processinstances enters the node. Then it depends on the signalling flag(Rule to exit the node on task completion) of the node 'last', 'last-wait' etc to exit the node to the specified transition.
If the create-task attribute is specified, all you got to do it get it from the list of taskinstances using TaskMgmtInstance. If you create a taskinstance on your own in this case, you will have duplicate taskinstances and the node will not exit until both are completed.
Hope this helps! -
2. Re: task-node attribute create-tasks
warfster Aug 8, 2007 9:36 AM (in response to warfster)I'll try to explain better.
When I *do not* specify the "create-tasks" attribute, a new taskinstance is created when the processinstance enters the task-node. This is as expected, but not what I'm trying to accomplish.
When I *do* specify the "create-tasks='false'" attribute within the task-node element, *no* taskinstance is created when the processinstance enters the task-node. This is the behavior I'm looking for.
What I'm not clear on is why the processinstance then takes the default transitions intead of the transitions specified in processinstance.signal(mytransition).
Hope this clarifiies my question. -
3. Re: task-node attribute create-tasks
kukeltje Aug 8, 2007 12:02 PM (in response to warfster)could be just a bug... look in the sourcecode if you can confirm this is a task created manually via the api after the nod e nas been entered or not?
-
4. Re: task-node attribute create-tasks
warfster Aug 8, 2007 12:31 PM (in response to warfster)A good point "...after the node has been entered...". The api is used to:
ProcessInstance pi = context.newProcessInstanceForUpdate("myProcess"); pid = pi.getId(); context.close(); context = getContext(); ProcessInstance pi = context.getProcessInstance(processInstanceId); TaskMgmtInstance tmi = pi.getTaskMgmtInstance(); TaskMgmtDefinition tmd = tmi.getTaskMgmtDefinition(); Task t = tmd.getTask(taskName); TaskInstance ti = tmi.createTaskInstance(t); ti.setActorId(actorId); ti.setName(taskInstanceName); ti.setDescription(taskInstanceDescription); ti.start(); context.save(ti); context.save(pi); context.close();
This happens programmatically before the processinstance has been signalled to leave the start state. The big picture is that for any given processdefinition (project) we want to post a list of all the taskinstances associated with it.
So in answer to your question, no, the task has not been created manually w/api after the node was entered. It was created manually w/api before the node was entered. Bug had not crossed my mind. It was more of a "I'm not using it correctly" concern. -
5. Re: task-node attribute create-tasks
warfster Aug 8, 2007 7:07 PM (in response to warfster)It seems that the task instance is not getting acknowledged even though the association in the db seems to be correct.
-
6. Re: task-node attribute create-tasks
warfster Aug 8, 2007 7:13 PM (in response to warfster)On the chance that the taskinstance is not associated with the processinstance, I tried to add the taskinstance after entering the task-node. The error message indicates it is already associated:
Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.jbpm.taskmgmt.exe.TaskInstance#2656]
Comments, criticisms or advice welcome. -
7. Re: task-node attribute create-tasks
warfster Aug 10, 2007 1:04 PM (in response to warfster)Resolved the problem by not creating the taskinstance before processinstance enters the task-node.
Thanks for the suggestions and comments. -
8. Re: task-node attribute create-tasks
kukeltje Aug 11, 2007 8:05 PM (in response to warfster)hey... when I said 'could be a bug' I meant could be a bug on OUR side... eventually you solved it yourself. Thanks btw for reporting back in detail so others can learn.
-
9. Re: task-node attribute create-tasks
warfster Aug 13, 2007 9:20 AM (in response to warfster)Your welcome, though the thanks are due to you, since it was your suggestion that pointed me in the direction of the solution.
'til next time.