code: @Override
    public void recordTaskId(TaskEntity task) {
      if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
        ExecutionEntity execution = task.getExecution();
        if (execution != null) {
          HistoricActivityInstanceEntity historicActivityInstance = findActivityInstance(execution, false, true);
          if (historicActivityInstance != null) {
            historicActivityInstance.setTaskId(task.getId());
          }
        }
      }
    }
docs: /*
  (non-Javadoc)
  
  @see org.activiti.engine.impl.history.HistoryManagerInterface#recordTaskId (org.activiti.engine.impl.persistence.entity.TaskEntity)