Package org.silverpeas.components.projectmanager.model

## Class ProjectManagerDAO

- java.lang.Object
- - org.silverpeas.components.projectmanager.model.ProjectManagerDAO

-     public class ProjectManagerDAO
      extends Object

  Author:
    neysseri

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static void` | `actionEstDecomposee​(Connection con, int id, int estDecomposee)` |
    `static int` | `addResource​(Connection con, TaskResourceDetail resource)` |
    `static int` | `addTask​(Connection con, TaskDetail task)` |
    `static Date` | `dbDate2Date​(String dbDate, String fieldName)` |
    `static void` | `deleteAllResources​(Connection con, int taskId, String instanceId)` |
    `static List<TaskDetail>` | `getAllTasks​(Connection con, String instanceId, Filtre filtre)` |
    `static TaskDetail` | `getMostDistantTask​(Connection con, int taskId)` |
    `static List<TaskDetail>` | `getNextTasks​(Connection con, int taskId)` |
    `static int` | `getOccupationByUser​(Connection con, String userId, Date dateDeb, Date dateFin)` |
    `static int` | `getOccupationByUser​(Connection con, String userId, Date dateDeb, Date dateFin, int excludedTaskId)` |
    `static List<TaskResourceDetail>` | `getResources​(Connection con, int taskId, String instanceId)` |
    `static TaskDetail` | `getTask​(Connection con, int id)` |
    `static TaskDetail` | `getTask​(Connection con, String id)` |
    `static List<TaskDetail>` | `getTasksByMotherId​(Connection con, String instanceId, int motherId)` | Gets the tasks by mother identifier if no filter, or filtered tasks on filter if any (so not on mother id in that case).
    `static List<TaskDetail>` | `getTasksByMotherIdAndPreviousId​(Connection con, String instanceId, int motherId, int previousId)` |
    `static List<TaskDetail>` | `getTree​(Connection con, int actionId)` |
    `static void` | `removeAllTasks​(Connection con, String instanceId)` | Deletes all the tasks and their associated resources in the specified project manager.
    `static void` | `removeTask​(Connection con, int id)` |
    `static void` | `updateTask​(Connection con, TaskDetail task)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### addTask

          public static int addTask​(Connection con,
                                    TaskDetail task)
                             throws SQLException

      Throws:
        `SQLException`

    - #### addResource

          public static int addResource​(Connection con,
                                        TaskResourceDetail resource)
                                 throws SQLException

      Throws:
        `SQLException`

    - #### updateTask

          public static void updateTask​(Connection con,
                                        TaskDetail task)
                                 throws SQLException

      Throws:
        `SQLException`

    - #### deleteAllResources

          public static void deleteAllResources​(Connection con,
                                                int taskId,
                                                String instanceId)
                                         throws SQLException

      Throws:
        `SQLException`

    - #### actionEstDecomposee

          public static void actionEstDecomposee​(Connection con,
                                                 int id,
                                                 int estDecomposee)
                                          throws SQLException

      Throws:
        `SQLException`

    - #### removeTask

          public static void removeTask​(Connection con,
                                        int id)
                                 throws SQLException

      Throws:
        `SQLException`

    - #### removeAllTasks

          public static void removeAllTasks​(Connection con,
                                            String instanceId)
                                     throws SQLException

      Deletes all the tasks and their associated resources in the specified project manager.
      Parameters:
        `con` - a connection to the data source into which are stored the tasks and the resources.
        `instanceId` - the unique identifier of a ProjectManager instance.
      Throws:
        `SQLException` - if an error occurs while deleting the tasks and the associated resources.

    - #### getTask

          public static TaskDetail getTask​(Connection con,
                                           String id)
                                    throws SQLException

      Throws:
        `SQLException`

    - #### getTask

          public static TaskDetail getTask​(Connection con,
                                           int id)
                                    throws SQLException

      Throws:
        `SQLException`

    - #### getResources

          public static List<TaskResourceDetail> getResources​(Connection con,
                                                              int taskId,
                                                              String instanceId)
                                                       throws SQLException

      Throws:
        `SQLException`

    - #### getAllTasks

          public static List<TaskDetail> getAllTasks​(Connection con,
                                                     String instanceId,
                                                     Filtre filtre)
                                              throws SQLException

      Throws:
        `SQLException`

    - #### getNextTasks

          public static List<TaskDetail> getNextTasks​(Connection con,
                                                      int taskId)
                                               throws SQLException

      Throws:
        `SQLException`

    - #### getMostDistantTask

          public static TaskDetail getMostDistantTask​(Connection con,
                                                      int taskId)
                                               throws SQLException

      Throws:
        `SQLException`

    - #### getTree

          public static List<TaskDetail> getTree​(Connection con,
                                                 int actionId)
                                          throws SQLException

      Parameters:
        `con` - a Connection to database
        `actionId` - the root of the tree
      Returns:
        the tree - a List of TaskDetail
      Throws:
        `SQLException` - if there is a SQL error.

    - #### getTasksByMotherId

          public static List<TaskDetail> getTasksByMotherId​(Connection con,
                                                            String instanceId,
                                                            int motherId)
                                                     throws SQLException

      Gets the tasks by mother identifier if no filter, or filtered tasks on filter if any (so not on mother id in that case).
      Parameters:
        `con` - the current database connection.
        `instanceId` - the identifier of the component instance.
        `motherId` - the identifier of the parent task.
      Returns:
        a list of `TaskDetail` instances.
      Throws:
        `SQLException` - on database error.

    - #### getTasksByMotherIdAndPreviousId

          public static List<TaskDetail> getTasksByMotherIdAndPreviousId​(Connection con,
                                                                         String instanceId,
                                                                         int motherId,
                                                                         int previousId)
                                                                  throws SQLException

      Throws:
        `SQLException`

    - #### getOccupationByUser

          public static int getOccupationByUser​(Connection con,
                                                String userId,
                                                Date dateDeb,
                                                Date dateFin)
                                         throws SQLException

      Throws:
        `SQLException`

    - #### getOccupationByUser

          public static int getOccupationByUser​(Connection con,
                                                String userId,
                                                Date dateDeb,
                                                Date dateFin,
                                                int excludedTaskId)
                                         throws SQLException

      Throws:
        `SQLException`

    - #### dbDate2Date

          public static Date dbDate2Date​(String dbDate,
                                         String fieldName)
                                  throws SQLException

      Throws:
        `SQLException`