-
1. Re: Task Nodes - conditionally create tasks?
kukeltje Oct 9, 2006 12:57 PM (in response to cpob)then why not have the task created by jbpm and ADD additional tasks runtime.... afaik that is a normal supported option.
-
2. Re: Task Nodes - conditionally create tasks?
cpob Oct 10, 2006 9:54 AM (in response to cpob)To add additional tasks during runtime, you'd have to create new task definitions. These tasks are already defined and created, we just don't want instances automatically started for every task def when the task node enters.
-
3. Re: Task Nodes - conditionally create tasks?
olivier_debels Oct 10, 2006 11:40 AM (in response to cpob)I think you can do something like:
Adding a task definition directly under the process definition (and not in the task node) and play with this:
* Then you can create a task instance of the mandatory task in the task node:
+ By using an event if you want to use the task definition under the process definition
+ By putting another task definition in the task node and setting "create-task" true
* You can create the other task instances using event handlers for example.
If you look at the test cases under org.jbpm.jpdl.patterns you can find some examples.
Hope this helps,
Olivier. -
4. Re: Task Nodes - conditionally create tasks?
cpob Oct 10, 2006 12:02 PM (in response to cpob)Then you can create a task instance of the mandatory task in the task node
There's no way to tie a task instance to a task node. It's only through the task def that there's a link between task/tasknode.
I'm already creating the other task instances using event handlers, but its important we have the task/tasknode relationship, and important not all are created at node entry.
We could just have NO tasks created at node entry, and then we manually create a task instance ourselves, but allowing the tasks to be created conditionally seems more elegant. -
5. Re: Task Nodes - conditionally create tasks?
olivier_debels Oct 11, 2006 4:07 AM (in response to cpob)There's no way to tie a task instance to a task node. It's only through the task def that there's a link between task/tasknode.
AFAIK you don't need the link task/tasknode. You can just have a task def tied to the process definition and create task instances in the task node (using event handlers f.e.). You can actually create task instances in any node.but it's important we have the task/tasknode relationship
Why?We could just have NO tasks created at node entry, and manually create a task instance ourselves, but allowing the tasks to be created conditionally seems more elegant
You can also create the tasks defined in the task node (mandatory ones), and create the ones defined at process definition level optionally. -
6. Re: Task Nodes - conditionally create tasks?
cpob Oct 11, 2006 9:08 AM (in response to cpob)Olivier_Debels wrote:
AFAIK you don't need the link task/tasknode. You can just have a task def tied to the process definition and create task instances in the task node (using event handlers f.e.). You can actually create task instances in any node.
We're already doing this. We have optional process tasks being created along the flow with various task nodes. We are creating them, tied to the process, not the task node, and they just need to be completed anytime during the process.
However....Olivier_Debels wrote:
but it's important we have the task/tasknode relationship
Why?
It is very important that we have some optional node tasks created with a task node relationship, because we want some optional node tasks to block the task node. If 1 mandatory and 3 optional node task instances are associated with a given node, we want the node to be blocking until all 4 tasks are completed. -
7. Re: Task Nodes - conditionally create tasks?
olivier_debels Oct 11, 2006 9:22 AM (in response to cpob)
Well I guess you can create your own custom task instance which can deal with this. It just requires overriding of the end() function and keeping a TaskNode reference. Haven't tried it but I guess this would work. -
8. Re: Task Nodes - conditionally create tasks?
cpob Oct 11, 2006 9:35 AM (in response to cpob)"Olivier_Debels" wrote:
Well I guess you can create your own custom task instance which can deal with this. It just requires overriding of the end() function and keeping a TaskNode reference. Haven't tried it but I guess this would work.
I don't think that would change my issue of creating optional task instances only when we want.
Making the change to support the AUTOCREATE column is far simpler than creating an optional task node. All that is needed is the if..statement in TaskNode's execute method and then support for the new column in the mapping/etc. -
9. Re: Task Nodes - conditionally create tasks?
olivier_debels Oct 11, 2006 10:10 AM (in response to cpob)"cpob" wrote:
Making the change to support the AUTOCREATE column is far simpler than creating an optional task node. All that is needed is the if..statement in TaskNode's execute method and then support for the new column in the mapping/etc.
Yep, I agree.
I this also useable if you want to create 2 mandatory and 3 optional instances of the same task def?
And what if the task def is not defined in a task node? I don't think a ref to task defs is possible.
Just wandering if the task/task node link as it exists now can' t be extended.
Anyway, I think your solution indeed gives an added value.
Thx,
Olivier. -
10. Re: Task Nodes - conditionally create tasks?
cpob Oct 11, 2006 11:04 AM (in response to cpob)"Olivier_Debels" wrote:
"cpob" wrote:
Making the change to support the AUTOCREATE column is far simpler than creating an optional task node. All that is needed is the if..statement in TaskNode's execute method and then support for the new column in the mapping/etc.
Yep, I agree.
I this also useable if you want to create 2 mandatory and 3 optional instances of the same task def?
Yes, that is what we would be using it for. It would allow the task to control it's fate for creation."Olivier_Debels" wrote:
And what if the task def is not defined in a task node? I don't think a ref to task defs is possible.
Just wandering if the task/task node link as it exists now can' t be extended.
Not sure if I follow you with this one. If a task def is not linked to a task node, it would just be the process task like we talked about. It would still be created (if using our flag idea) conditionally, depending on if the user creates the instances, or a task event, etc. -
11. Re: Task Nodes - conditionally create tasks?
olivier_debels Oct 11, 2006 11:27 AM (in response to cpob)"Olivier_Debels" wrote:
And what if the task def is not defined in a task node? I don't think a ref to task defs is possible.
Just wandering if the task/task node link as it exists now can' t be extended.
Not sure if I follow you with this one. If a task def is not linked to a task node, it would just be the process task like we talked about. It would still be created (if using our flag idea) conditionally, depending on if the user creates the instances, or a task event, etc.
Never mind, I was just thinking about splitting definition of a task and linkage to a node (task node). Anyway at some point you need to define the link.
Greetz,
Olivier. -
12. Re: Task Nodes - conditionally create tasks?
tom.baeyens Oct 11, 2006 3:38 PM (in response to cpob)didn't read the whole thread. sorry if i duplicate an answer.
...but did you consider defining the tasks in the task-node and specifycreate-tasks="false"
on the task node ? that way, can still fetch the task definitions and create instances at runtime and you have the
link to the task-node. -
13. Re: Task Nodes - conditionally create tasks?
cpob Oct 11, 2006 4:10 PM (in response to cpob)"tom.baeyens@jboss.com" wrote:
didn't read the whole thread. sorry if i duplicate an answer.
...but did you consider defining the tasks in the task-node and specifycreate-tasks="false"
on the task node ? that way, can still fetch the task definitions and create instances at runtime and you have the
link to the task-node.
I mentioned this as an alternative in one of my earlier posts. However, the problem with this, is that it puts the burden of creating the mandatory tasks on us. Something we'd much rather let jBPM handle, since it does it already.
Sure, it's not hard to make our code create the mandatory task instances, as we are already creating optional task instances, but I'm a big fan of configurability :)