AnsweredAssumed Answered

Can't get historicTaskInstance By unfinished filter

Question asked by smartxiaofish on Jun 19, 2015
Latest reply on Jun 23, 2015 by smartxiaofish
Hi~
i have some tasks completed and deleted before completed.
and i tried  historySrv.createHistoricTaskInstanceQuery().finshed() and unfinished().

here is the test code

      Task task = taskSrv.newTask();
      task.setName("test execution");
      task.setOwner(user1.getId());
      task.setAssignee(user2.getId());
      taskSrv.saveTask(task);
      
      // delete it
      taskSrv.deleteTask(task.getId(), "ownerDelete");
      
      // check deletion by assignee
      List<HistoricTaskInstance> hisTaskListByAssignee = historySrv.createHistoricTaskInstanceQuery()
                                       .taskAssignee(user2.getId()).list();
      assertEquals(1, hisTaskListByAssignee.size()); // passed
      assertEquals("ownerDelete", hisTaskListByAssignee.get(0).getDeleteReason());
      
      
      // check deletion by owner
      List<HistoricTaskInstance> hisTaskListByOwner = historySrv.createHistoricTaskInstanceQuery()
                                       .taskOwner(user1.getId()).unfinished().list();
      assertEquals(1, hisTaskListByOwner.size()); // failed and hisTaskListByOwner.size() is 0
      assertEquals("ownerDelete", hisTaskListByOwner.get(0).getDeleteReason());


it seems that finished task doesn't mean completed task.
so what does finished tasks and unfinished tasks mean in historicTaskInstance ?
and is there any way to get tasks completed and deleted before completed in HistoricTaskInstanceQuery?

appreciate for any reply.

Outcomes