Class FileN8nTaskDAO

java.lang.Object
ru.bgcrm.dao.CommonDAO
org.bgerp.plugin.ai.aixflow.dao.FileN8nTaskDAO

public class FileN8nTaskDAO extends CommonDAO
DAO for file_n8n_tasks table
  • Constructor Details

    • FileN8nTaskDAO

      public FileN8nTaskDAO(Connection con)
  • Method Details

    • create

      public FileN8nTask create(FileN8nTask task) throws SQLException
      Create a new task
      Parameters:
      task - the task to create
      Returns:
      the created task with ID set
      Throws:
      SQLException - if a database error occurs
    • getById

      public FileN8nTask getById(int id) throws SQLException
      Get a task by ID
      Parameters:
      id - the task ID
      Returns:
      the task or null if not found
      Throws:
      SQLException - if a database error occurs
    • getByFileId

      public List<FileN8nTask> getByFileId(int fileId) throws SQLException
      Get tasks by file ID
      Parameters:
      fileId - the file ID
      Returns:
      list of tasks for the file
      Throws:
      SQLException - if a database error occurs
    • getByTaskId

      public FileN8nTask getByTaskId(String taskId) throws SQLException
      Get task by task ID
      Parameters:
      taskId - the n8n task ID
      Returns:
      the task or null if not found
      Throws:
      SQLException - if a database error occurs
    • updateTaskStatus

      public boolean updateTaskStatus(String taskId, String status, String result, String errorMessage) throws SQLException
      Update task status
      Parameters:
      taskId - the n8n task ID
      status - the new status
      result - the result (can be null)
      errorMessage - the error message (can be null)
      Returns:
      true if the task was updated, false if not found
      Throws:
      SQLException - if a database error occurs
    • delete

      public boolean delete(int id) throws SQLException
      Delete a task
      Parameters:
      id - the task ID
      Returns:
      true if the task was deleted, false if not found
      Throws:
      SQLException - if a database error occurs
    • getAllTasks

      public List<FileN8nTask> getAllTasks(String status, int limit) throws SQLException
      Get all tasks with optional filtering
      Parameters:
      status - optional status filter
      limit - maximum number of tasks to return (0 for no limit)
      Returns:
      list of all tasks matching the criteria
      Throws:
      SQLException - if a database error occurs