@Override
  public List<Task> getCurrentTaskInstances(CoreSession coreSession) throws ClientException {

    // Get tasks for current user
    // We need to build the task actors list: prefixed and unprefixed names
    // of the principal and all its groups
    NuxeoPrincipal principal = (NuxeoPrincipal) coreSession.getPrincipal();
    List<String> actors = TaskActorsHelper.getTaskActors(principal);

    return getCurrentTaskInstances(actors, coreSession);
  }
 @Override
 public List<Task> getTaskInstances(DocumentModel dm, NuxeoPrincipal user, CoreSession coreSession)
     throws ClientException {
   String query;
   if (user == null) {
     query = String.format(TaskQueryConstant.GET_TASKS_FOR_TARGET_DOCUMENT_QUERY, dm.getId());
   } else {
     List<String> actors = TaskActorsHelper.getTaskActors(user);
     String userNames = TaskQueryConstant.formatStringList(actors);
     query =
         String.format(
             TaskQueryConstant.GET_TASKS_FOR_TARGET_DOCUMENT_AND_ACTORS_QUERY,
             dm.getId(),
             userNames);
   }
   return queryTasksUnrestricted(query, coreSession);
 }
 @Override
 public List<Task> getAllTaskInstances(String processId, NuxeoPrincipal user, CoreSession session)
     throws ClientException {
   List<String> actors = TaskActorsHelper.getTaskActors(user);
   return getAllTaskInstances(processId, actors, session);
 }