cancel
Showing results for 
Search instead for 
Did you mean: 

dueDate and taskList

luisalves00
Champ in-the-making
Champ in-the-making
Hello

I'm using the dueDate attribute in one of my workflows, as in the next code block


<userTask id="renew_request"
         name="Renew Request(${requestNumber})"
         activiti:assignee="${assignee}" activiti:dueDate="${dueDate}">

then I show the user tasks using:


tasks = getActivitiEngine().getTaskService().createTaskQuery().taskAssignee(userID).orderByTaskPriority().asc().orderByTaskCreateTime().asc().list();

Question:

How to not show the due tasks? 

   … not sure if .dueAfter( today ) will have the expected result since most of the task don't have an dueDate.

best regards,
la00
4 REPLIES 4

frederikherema1
Star Contributor
Star Contributor
Hi, there is no way of querying for tasks that don't have a duedate. You can use a workaround, since the query clause used is this:
<if test="dueBefore != null">
        and T.DUE_DATE_ &lt; #{dueBefore}
      </if>

Maybe before new Date(0)?

luisalves00
Champ in-the-making
Champ in-the-making
Is there a way to complete a due task?

What I need is "delete" all due tasks…

something like this:

EDIT

    private List<Task> removeDueTask(List<Task> list) {
        List<Task> newList = new ArrayList<Task>();
        Date now = new Date();
        for(Task t : list){
            if(t.getDueDate() != null && t.getDueDate().before(now)){
                getActivitiEngine().getTaskService().complete(t.getId());
            }else{
                newList.add(t);
            }
        }
        return list;
    }

frederikherema1
Star Contributor
Star Contributor
The only thing you can do is delete the process-instance to have the task removed as well:

RuntimeService
void deleteProcessInstance(String processInstanceId, String deleteReason);

Btw, with the code you posted, You'll get a ConcurrentModificationException Smiley Wink

luisalves00
Champ in-the-making
Champ in-the-making
yeah I know Smiley Wink tks frederikheremans