cancel
Showing results for 
Search instead for 
Did you mean: 

Bug with TaskQuery.taskCandidateOrAssigned?

schmke
Champ in-the-making
Champ in-the-making
I'm seeing some behavior with using TaskQuery.taskCandidateOrAssigned that seems like a bug but wanted to check before opening an issue.

I have a process with two different user tasks, one called Manager with a candidate group manager and another called Review with no candidate group.  I have my own GroupEntityManager that implements the findGroupsByUser method and it is being called and working fine in most cases to get the groups for a user and return the right thing when using TaskQuery.taskCandidateUser for example.

Here is the scenario.

Two process instances are created that are at the Manager user task.  One is assigned to user john and the other is unassigned.  Additionally, there is a process instance at the Review task and it is assigned to andy.

Using taskCandidateUser with user andy returns the unassigned Manager task which is correct.  It does not return the task assigned to john nor the Review task assigned to andy.

However, if I use taskCandidateOrAssigned instead, just the Review task is returned.  I would expect this to still return the unassigned task as it is a candidate.

Looking at the code, specifically Task.xml, it appears for the taskCandidateUser case, the SQL generated includes something like this which uses the candidateGroups retrieved from my GroupEntityManager:

          <if test="candidateGroups != null &amp;&amp; candidateGroups.size() &gt; 0">
            I.GROUP_ID_ IN
            <foreach item="group" index="index" collection="candidateGroups"
                     open="(" separator="," close=")">
              #{group}
            </foreach>
          </if>

But in the case of using taskCandidateOrAssigned it is not, instead it is only using the internal table with this:

            <if test="candidateGroups == null">
              and (RES.ASSIGNEE_ = #{userIdForCandidateAndAssignee} or (RES.ASSIGNEE_ is null and (I.USER_ID_ = #{userIdForCandidateAndAssignee}
              or I.GROUP_ID_ IN (select g.GROUP_ID_ from ${prefix}ACT_ID_MEMBERSHIP g where g.USER_ID_ = #{userIdForCandidateAndAssignee} ) ) ) )
            </if>


This seems like a bug to me, what is returned from taskCandidateOrAssigned should include everything returned from taskCandidateUser plus any assigned, and it shouldn't matter if a custom GroupEntityManager is used or not.

Please confirm and let me know if I need to open an issue.

Note, I'm using 5.19.0.2.

Thanks,

Kevin

2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
I'm assuming this is yours: https://github.com/Activiti/Activiti/pull/846? We'll discuss further there (but give us a couple of days, lots of PR's to process!)

schmke
Champ in-the-making
Champ in-the-making
Yep, that is it.  Thanks for taking a look.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.