cancel
Showing results for 
Search instead for 
Did you mean: 

How to change default claim and complete behavior of Tasks?

swapnonil
Champ in-the-making
Champ in-the-making
If have understood correctly,

When a task is assigned to a group it appears in the Inbox of all users in that group. Now if anyone belonging to that group logs in and claims that task, it will disappear from the task list of all other users in that group. And when that user completes the task, it will be deemed as completed.

What I want to do is implement a Parallel Voting Pattern. I want to assign a voting task to a group, and then when 75% of all members in that group have completed the task, I want the execution to flow to the next sequence.

The process I am trying to build is described here.

http://wiki.hudson-ci.org/display/HUDSON/JBPM+Plugin

So I was thinking that if I could change the default claim > complete cycle of user tasks, then may be I can implement this pattern.

Or am I approaching this from the wrong direction?

Thanks
Swapnonil Mukherjee
3 REPLIES 3

chnxan
Champ in-the-making
Champ in-the-making
sorry, my english is very poor.
I hope you can understand my words.

i think…
You can try to use Multi-instance (for each).

like this:

<userTask id="id" name="name" activiti:assignee="${assignee}">
    <extensionElements>
        <activiti:taskListener event="create" class="com.test.bpm.listener.CreateListener"></activiti:taskListener>
        <activiti:taskListener event="complete" class="com.test.bpm.listener.CompleteListener"></activiti:taskListener>
     </extensionElements>
     <multiInstanceLoopCharacteristics isSequential="false">
        <loopDataInputRef>assigneeList</loopDataInputRef>
        <inputDataItem name="assignee"></inputDataItem>
        <completionCondition>${beFinished.equals("true")}</completionCondition>
     </multiInstanceLoopCharacteristics>
</userTask>

in its complete event,you can make a rule to decide what time this userTask will be finished.
like this: its my rule ,when  submit or reject count > a number, finish the task

String transition = (String) delegateTask.getVariable("transition");
int nrOfInstances = (Integer) delegateTask.getVariable("nrOfInstances");
int submitCount = (Integer) delegateTask.getVariable("submitCount");
int rejectCount = (Integer) delegateTask.getVariable("rejectCount");
int percent = (Integer) delegateTask.getVariable("percent");

if (transition.equals("submit")) {
submitCount++;
delegateTask.setVariable("submitCount", submitCount);
} else {
rejectCount++;
delegateTask.setVariable("rejectCount", rejectCount);
}
if (submitCount > nrOfInstances * Percent / 100 || rejectCount > nrOfInstances * Percent / 100)
delegateTask.setVariable("beFinished", "true");
else
delegateTask.setVariable("beFinished", "false");

and use this, you must make a Exclusive gateway after the task, because the Multi-instance(isSequential = "false") seem to include a Parallel Gateway.
if you don't, when Multi-instance(isSequential = "false")  be finished , it will take all the OutgoingTransition.

sorry , my english is very poor. I finished this words with the help of google translation…

swapnonil
Champ in-the-making
Champ in-the-making
Looks perfect to me.

Let me try this out. Thanks.

deepak_singhvi
Champ in-the-making
Champ in-the-making
Did it work for you?
Are you able to create a scenario for the voting with activiti (with or without using multi-instance)?


Deepak