cancel
Showing results for 
Search instead for 
Did you mean: 

AND condition on candidateGroup?

petter_f
Champ in-the-making
Champ in-the-making
Hi all,

I need some assistance in how to achieve AND conditions on groups. Our business requirements are basically that in some cases it is enough that the user has one of the stated groups (as in activiti:candidateGroups), in some cases they need to belong to both. As far as my understanding of Activiti goes, there is currently no support for this? I guess implementing this would require at least a notion of the AND-condition in the activiti:candidateGroups specification, either by using e.g. "&group1"/"|group1", or by introducing a new function like candidateGroupsInclusive() or similar….

I really need to achieve this in the short term so any pointers as to where to begin to implement this by myself would be appreciated. I did start to look into simply patching selectTaskByQueryCriteriaSql section of Task.xml but realized that the actual process definition needs to express the AND/OR conditions on multiple groups…..I'm currently thinking about parsing the actual group names to retrieve an & or | character and then build the query accordingly but then again a more general solution that takes grouped conditions into account (like "(group1&group2)|group3") would be much more sustainable in the long run.

Hope I got my needs explained, if anyone has one pointers about how to go about this, I would be thrilled.

Regards,
/Petter
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
The activiti:candidateGroup is just a shorthand for the verbose BPMN2.0 way of defining candidates for a user-task. In this syntax, no AND/OR semantics are present, so it's unlikely this attribute will be adjusted to the use-case you describe.

An approach you *could* take is to use a BPMNParseListener to alter the values of the candidates on the user-taks and further down in the implementation, use an altered version of the task-query that is used… However, this will require some digging into the activiti-code.

Another approach would be to have "special" groups, e.g. of a candidate-expression: "group(group1&group2), group(group3)".
By default, the expression will resolve to 2 groups: "group1&group2" and "group3". In activiti, this means part of "group1&group2" or "group3". Now, if you alter the identity-management to return these "special" groups as "groups a user belongs to", activiti will show the task as claimable by someone in group1 and group2.

Offcourse, this means a user gets a lot of extra special groups, when part of a lot of "normal" groups. So some kind or "restricting" mechanism should be created to only make special groups for well-known groups which are likely to be used in "AND" semantics…

petter_f
Champ in-the-making
Champ in-the-making
Thanks for the response Frederik,

I think I will have to go along the lines of the second approach you mention. Need to have a discussion with the business side in order to minimize the number of special occasions.

Hopefully someday the AND condition on groups will be supported in bpmn. The truth of the matter is that I am in reality modeling teams and skills as groups in Activity, and the need for AND conditions arises from this fact….Maybe I simply need to implement this on the "outside", but I was looking for a way to do it directly in Activity since I am a bit concerned about performance issues when doing it programtically in my own code…

Regards,
/Petter

jbarrez
Star Contributor
Star Contributor
I actually think we should have support for expression in there …

So I created http://jira.codehaus.org/browse/ACT-1448