AnsweredAssumed Answered

Some questions in Task query?

Question asked by bojiang on Mar 15, 2011
Latest reply on Mar 21, 2011 by jbarrez
    When I want to query tasks ,I use TaskQuery to add some criteria. I want to query all the tasks that a user can do ,including tasks assigned to this user , and tasks can be pulled by this user. I use the below code to do this query.
pe.getTaskService().createTaskQuery().taskAssignee("life").taskCandidateUser("life").orderByTaskCreateTime().desc().listPage(0, 1000)
    And I found the generated sql is :
select distinct T.* from ACT_RU_TASK T 
            inner join ACT_RU_IDENTITYLINK I on I.TASK_ID_ = T.ID_
           WHERE T.ASSIGNEE_ = ?
           and T.ASSIGNEE_ is null
           and I.TYPE_ = 'candidate'
           and ( I.USER_ID_ = ? )
           order by T.CREATE_TIME_ desc
    First , T.ASSIGNEE_ = ?  and T.ASSIGNEE_ is conflicted.
    Second, if using keyword distinct, the order is sorted, so here i can not get the order order by T.CREATE_TIME_ desc.
   Some questions in query .
   1. Is there any existing interface  that can query all the tasks a user can do, or  union  the result in code?
   2. Is there any existing interface that can query tasks by one variable or more variables? If one user want to search a task he can do ,and the tasks have variable a values A and variable b values B, how can I organize the query code with best performance? Query in this table act_ru_variable, more variable criteria,more cycles.