/**
  * 反签收
  *
  * @param taskId 任务id
  */
 @Override
 public void unclaim(String taskId) {
   boolean canUnclaim = false;
   // 反签收条件过滤
   List<IdentityLink> links = taskService.getIdentityLinksForTask(taskId);
   for (IdentityLink identityLink : links) {
     canUnclaim = StringUtils.equals(IdentityLinkType.CANDIDATE, identityLink.getType());
     if (canUnclaim) {
       taskService.claim(taskId, null);
       break;
     }
   }
   if (!canUnclaim) {
     throw new BusinessException(ReturnCodeConstant.UNCLAIM_TASK);
   }
 }
  /**
   * Generic method which will figure out to which task page must be jumped, based on the task data.
   *
   * <p>Note that, if possible, it is always more performant to use the more specific showXXXPage()
   * methods.
   */
  public void showTaskPage(String taskId) {
    Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
    String loggedInUserId = ExplorerApp.get().getLoggedInUser().getId();

    if (task == null) {
      // If no runtime task exists, our only hope is the archive page
      boolean isOwner =
          historyService
                  .createHistoricTaskInstanceQuery()
                  .taskId(taskId)
                  .taskOwner(loggedInUserId)
                  .count()
              == 1;
      if (isOwner) {
        showArchivedPage(taskId);
      } else {
        showNavigationError(taskId);
      }
    } else if (loggedInUserId.equals(task.getOwner())) {
      showTasksPage(taskId);
    } else if (loggedInUserId.equals(task.getAssignee())) {
      showInboxPage(taskId);
    } else if (taskService.createTaskQuery().taskInvolvedUser(loggedInUserId).count() == 1) {
      showInvolvedPage(taskId);
    } else {
      // queued
      List<String> groupIds = getGroupIds(loggedInUserId);
      List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(task.getId());
      Iterator<IdentityLink> identityLinkIterator = identityLinks.iterator();

      boolean pageFound = false;
      while (!pageFound && identityLinkIterator.hasNext()) {
        IdentityLink identityLink = identityLinkIterator.next();
        if (identityLink.getGroupId() != null && groupIds.contains(identityLink.getGroupId())) {
          showQueuedPage(identityLink.getGroupId(), task.getId());
          pageFound = true;
        }
      }

      // We've tried hard enough, the user now gets a notification. He deserves it.
      if (!pageFound) {
        showNavigationError(taskId);
      }
    }
  }