cancel
Showing results for 
Search instead for 
Did you mean: 

Select tasks by candidateUser or candidateGroups

fersmi
Champ in-the-making
Champ in-the-making
Hi,
I tried select all task by candidateUser or candidateGroups in TaskQuery
taskService.createTaskQuery().taskCandidateGroupIn(roleNames).taskCandidateUser(user.getUsername()).orderByDueDate().asc().list();
but I got
ActivitiException - Invalid query usage: cannot set both candidateUser and candidateGroupIn

My question is: If this select is not allowed why in iBatis query mapping is this:

    <if test="candidateUser != null || candidateGroups != null">
        and T.ASSIGNEE_ is null
        and I.TYPE_ = 'candidate'
        and
        (
          <if test="candidateUser != null">
            I.USER_ID_ = #{candidateUser}         
          </if>
          <if test="candidateUser != null &amp;&amp; candidateGroups != null &amp;&amp; candidateGroups.size() &gt; 0">
            or
          </if>
          <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>
        )
      </if>

The mapping allows both candidateUser or candidateGroups at the same time.

And I need taht query!!
21 REPLIES 21

jbarrez
Star Contributor
Star Contributor
The current master branch has a way to do this, using or() with the taskCandidateUsers and taskCandidateGroupIn. It will be part of 5.18 (planned for end this month).

bam
Champ in-the-making
Champ in-the-making
OK great, I'll make a workaround until then.
Thanks.