net.sf.borg.model.db.jdbc
Class TaskJdbcDB

java.lang.Object
  extended by net.sf.borg.model.db.jdbc.JdbcDB
      extended by net.sf.borg.model.db.jdbc.JdbcBeanDB<Task>
          extended by net.sf.borg.model.db.jdbc.TaskJdbcDB
All Implemented Interfaces:
EntityDB<Task>, TaskDB

public class TaskJdbcDB
extends JdbcBeanDB<Task>
implements TaskDB

this is the JDBC layer for access to the task table.


Field Summary
 
Fields inherited from class net.sf.borg.model.db.jdbc.JdbcDB
connection_
 
Constructor Summary
TaskJdbcDB()
           
 
Method Summary
 void addLog(int taskid, String desc)
          Adds a task log for a task.
 void addObj(Task task)
          Adds a KeyedEntity to the database
 void addProject(Project p)
          Adds a project to the db.
 void addSubTask(Subtask s)
          Adds a sub task.
(package private)  Task createFrom(ResultSet r)
          Fills in an entity from a result set
 void delete(int key)
          Delete a KeyedEntity from the database
 void deleteProject(int id)
          Delete a project by id
 void deleteSubTask(int id)
          Delete a sub task by id.
 Collection<Integer> getKeys()
          Gets the keys.
 Collection<Tasklog> getLogs()
          Gets all task logs in the db.
 Collection<Tasklog> getLogs(int taskid)
          Gets all task logs for a given task.
 Project getProject(int projectid)
          Gets a project by id.
 Collection<Project> getProjects()
          Gets all projects in the database.
(package private)  PreparedStatement getPSAll()
           
(package private)  PreparedStatement getPSOne(int key)
           
 Collection<Project> getSubProjects(int projectid)
          Gets all sub projects (child projects) for a given project.
 Subtask getSubTask(int id)
          Gets a sub task by subtask id.
 Collection<Subtask> getSubTasks()
          Gets all sub tasks in the database.
 Collection<Subtask> getSubTasks(int taskid)
          Gets all sub tasks for a given task.
 Collection<Task> getTasks(int projectid)
          Gets all tasks for a given project.
 Task newObj()
          Return a new instance of the KeyedEntity
 int nextkey()
          get the next available key value for this entity type
 int nextProjectKey()
          get the Next available project key.
 int nextSubTaskKey()
          get the Next available sub task key.
 void saveLog(Tasklog tlog)
          Save a task log in the db.
 void updateObj(Task task)
          Update a KeyedEntity in the database
 void updateProject(Project s)
          Updates a project in the db.
 void updateSubTask(Subtask s)
          Update a sub task.
 
Methods inherited from class net.sf.borg.model.db.jdbc.JdbcBeanDB
delCache, emptyCache, readAll, readCache, readObj, sync, writeCache
 
Methods inherited from class net.sf.borg.model.db.jdbc.JdbcDB
beginTransaction, buildDbDir, close, commitTransaction, connect, execSQL, getConnection, getOption, getOptions, getUrl, rollbackTransaction, setOption, toInt, toInt, toStr, toVect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.borg.model.db.EntityDB
readAll, readObj, sync
 

Constructor Detail

TaskJdbcDB

public TaskJdbcDB()
Method Detail

addObj

public void addObj(Task task)
            throws Exception
Description copied from interface: EntityDB
Adds a KeyedEntity to the database

Specified by:
addObj in interface EntityDB<Task>
Parameters:
task - the KeyedEntity
Throws:
Exception

delete

public void delete(int key)
            throws Exception
Description copied from interface: EntityDB
Delete a KeyedEntity from the database

Specified by:
delete in interface EntityDB<Task>
Parameters:
key - the key of the entity
Throws:
Exception

getKeys

public Collection<Integer> getKeys()
                            throws Exception
Gets the keys.

Returns:
the keys
Throws:
Exception - the exception

nextkey

public int nextkey()
            throws Exception
Description copied from interface: EntityDB
get the next available key value for this entity type

Specified by:
nextkey in interface EntityDB<Task>
Returns:
the next available key
Throws:
Exception

newObj

public Task newObj()
Description copied from interface: EntityDB
Return a new instance of the KeyedEntity

Specified by:
newObj in interface EntityDB<Task>
Returns:
the new KeyedEntity

getPSOne

PreparedStatement getPSOne(int key)
                     throws SQLException
Specified by:
getPSOne in class JdbcBeanDB<Task>
Returns:
a PreparedStatement that reads one entity by key
Throws:
SQLException

getPSAll

PreparedStatement getPSAll()
                     throws SQLException
Specified by:
getPSAll in class JdbcBeanDB<Task>
Returns:
a PreparedStatement that reads all entities from a table
Throws:
SQLException

createFrom

Task createFrom(ResultSet r)
          throws SQLException
Description copied from class: JdbcBeanDB
Fills in an entity from a result set

Specified by:
createFrom in class JdbcBeanDB<Task>
Parameters:
r - the result set
Returns:
the entity
Throws:
SQLException

updateObj

public void updateObj(Task task)
               throws Exception
Description copied from interface: EntityDB
Update a KeyedEntity in the database

Specified by:
updateObj in interface EntityDB<Task>
Parameters:
task - the KeyedEntity
Throws:
Exception

getSubTasks

public Collection<Subtask> getSubTasks(int taskid)
                                throws SQLException
Description copied from interface: TaskDB
Gets all sub tasks for a given task.

Specified by:
getSubTasks in interface TaskDB
Parameters:
taskid - the taskid
Returns:
the sub tasks
Throws:
SQLException

getSubTasks

public Collection<Subtask> getSubTasks()
                                throws SQLException
Description copied from interface: TaskDB
Gets all sub tasks in the database.

Specified by:
getSubTasks in interface TaskDB
Returns:
the sub tasks
Throws:
SQLException

getSubTask

public Subtask getSubTask(int id)
                   throws SQLException
Description copied from interface: TaskDB
Gets a sub task by subtask id.

Specified by:
getSubTask in interface TaskDB
Parameters:
id - the id
Returns:
the sub task
Throws:
SQLException

deleteSubTask

public void deleteSubTask(int id)
                   throws SQLException
Description copied from interface: TaskDB
Delete a sub task by id.

Specified by:
deleteSubTask in interface TaskDB
Parameters:
id - the id
Throws:
SQLException

addSubTask

public void addSubTask(Subtask s)
                throws SQLException
Description copied from interface: TaskDB
Adds a sub task.

Specified by:
addSubTask in interface TaskDB
Parameters:
s - the subtask
Throws:
SQLException

updateSubTask

public void updateSubTask(Subtask s)
                   throws SQLException
Description copied from interface: TaskDB
Update a sub task.

Specified by:
updateSubTask in interface TaskDB
Parameters:
s - the subtask
Throws:
SQLException

nextSubTaskKey

public int nextSubTaskKey()
                   throws Exception
Description copied from interface: TaskDB
get the Next available sub task key.

Specified by:
nextSubTaskKey in interface TaskDB
Returns:
the next available sub task key
Throws:
Exception - the exception

addLog

public void addLog(int taskid,
                   String desc)
            throws SQLException
Description copied from interface: TaskDB
Adds a task log for a task.

Specified by:
addLog in interface TaskDB
Parameters:
taskid - the task id
desc - the log text
Throws:
SQLException

saveLog

public void saveLog(Tasklog tlog)
             throws SQLException
Description copied from interface: TaskDB
Save a task log in the db.

Specified by:
saveLog in interface TaskDB
Parameters:
tlog - the task log object
Throws:
SQLException

getLogs

public Collection<Tasklog> getLogs(int taskid)
                            throws SQLException
Description copied from interface: TaskDB
Gets all task logs for a given task.

Specified by:
getLogs in interface TaskDB
Parameters:
taskid - the task id
Returns:
the logs
Throws:
SQLException

getLogs

public Collection<Tasklog> getLogs()
                            throws SQLException
Description copied from interface: TaskDB
Gets all task logs in the db.

Specified by:
getLogs in interface TaskDB
Returns:
the logs
Throws:
SQLException

addProject

public void addProject(Project p)
                throws SQLException
Description copied from interface: TaskDB
Adds a project to the db.

Specified by:
addProject in interface TaskDB
Parameters:
p - the project
Throws:
SQLException

deleteProject

public void deleteProject(int id)
                   throws SQLException
Description copied from interface: TaskDB
Delete a project by id

Specified by:
deleteProject in interface TaskDB
Parameters:
id - the project id
Throws:
SQLException

getProject

public Project getProject(int projectid)
                   throws SQLException
Description copied from interface: TaskDB
Gets a project by id.

Specified by:
getProject in interface TaskDB
Parameters:
projectid - the project id
Returns:
the project
Throws:
SQLException

getProjects

public Collection<Project> getProjects()
                                throws SQLException
Description copied from interface: TaskDB
Gets all projects in the database.

Specified by:
getProjects in interface TaskDB
Returns:
the projects
Throws:
SQLException

getTasks

public Collection<Task> getTasks(int projectid)
                          throws SQLException
Description copied from interface: TaskDB
Gets all tasks for a given project.

Specified by:
getTasks in interface TaskDB
Parameters:
projectid - the project id
Returns:
the tasks
Throws:
SQLException

getSubProjects

public Collection<Project> getSubProjects(int projectid)
                                   throws SQLException
Description copied from interface: TaskDB
Gets all sub projects (child projects) for a given project.

Specified by:
getSubProjects in interface TaskDB
Parameters:
projectid - the project id
Returns:
the sub projects
Throws:
SQLException

nextProjectKey

public int nextProjectKey()
                   throws Exception
Description copied from interface: TaskDB
get the Next available project key.

Specified by:
nextProjectKey in interface TaskDB
Returns:
the next available project key
Throws:
Exception - the exception

updateProject

public void updateProject(Project s)
                   throws SQLException
Description copied from interface: TaskDB
Updates a project in the db.

Specified by:
updateProject in interface TaskDB
Parameters:
s - the project
Throws:
SQLException


Generated September 24 2010 by mbb using Apache Ant version 1.7.1 compiled on June 27 2008 and Java version 1.6.0_20 from Sun Microsystems Inc. on Linux i386 2.6.24-28-generic