org.opencms.db
Interface I_CmsWorkflowDriver

All Known Implementing Classes:
CmsWorkflowDriver

public interface I_CmsWorkflowDriver

Definitions of all required workflow driver methods.

Since:
6.0.0
Version:
$Revision: 1.29 $
Author:
Thomas Weckert, Michael Emmerich

Field Summary
static int DRIVER_TYPE_ID
          The type ID to identify workflow driver implementations.
 
Method Summary
 CmsTask createTask(CmsDbContext dbc, int rootId, int parentId, int tasktype, CmsUUID ownerId, CmsUUID agentId, CmsUUID roleId, java.lang.String taskname, java.sql.Timestamp wakeuptime, java.sql.Timestamp timeout, int priority)
          Creates a new task.
 void destroy()
          Destroys this driver.
 void endTask(CmsDbContext dbc, int taskId)
          Ends a task.
 void forwardTask(CmsDbContext dbc, int taskId, CmsUUID newRoleId, CmsUUID newUserId)
          Forwards a task to a new user.
 CmsSqlManager getSqlManager()
          Returns the SqlManager of this driver.
 CmsSqlManager initSqlManager(java.lang.String classname)
          Initializes the SQL manager for this driver.
 CmsUUID readAgent(CmsDbContext dbc, CmsUUID roleId)
          Finds an agent for a given role (group).
 CmsProject readProject(CmsDbContext dbc, CmsTask task)
          Reads a project of a given task.
 java.util.List readProjectLogs(CmsDbContext dbc, int projectId)
          Reads all task log entries for a project.
 CmsTask readTask(CmsDbContext dbc, int id)
          Reads the task with the given id.
 CmsTaskLog readTaskLog(CmsDbContext dbc, int id)
          Reads a log for a task.
 java.util.List readTaskLogs(CmsDbContext dbc, int taskId)
          Reads log entries for a task.
 java.lang.String readTaskParameter(CmsDbContext dbc, int taskId, java.lang.String parName)
          Returns the value of the given parameter for the given task.
 java.util.List readTasks(CmsDbContext dbc, CmsProject project, CmsUser agent, CmsUser owner, CmsGroup role, int taskType, java.lang.String orderBy, java.lang.String sort)
          Reads all given tasks from a user for a project.
 int readTaskType(CmsDbContext dbc, java.lang.String taskName)
          Get the template task id fo a given taskname.
 void writeSystemTaskLog(CmsDbContext dbc, int taskid, java.lang.String comment)
          Writes a system task log entry.
 CmsTask writeTask(CmsDbContext dbc, CmsTask task)
          Writes a task.
 void writeTaskLog(CmsDbContext dbc, int taskId, CmsUUID userId, java.sql.Timestamp starttime, java.lang.String comment, int type)
          Writes new log for a task.
 void writeTaskParameter(CmsDbContext dbc, int taskId, java.lang.String parname, java.lang.String parvalue)
          Set a Parameter for a task.
 void writeTaskType(CmsDbContext dbc, int autofinish, int escalationtyperef, java.lang.String htmllink, java.lang.String name, java.lang.String permission, int priorityref, int roleref)
          Creates a new tasktype set in the database.
 

Field Detail

DRIVER_TYPE_ID

public static final int DRIVER_TYPE_ID
The type ID to identify workflow driver implementations.

See Also:
Constant Field Values
Method Detail

createTask

public CmsTask createTask(CmsDbContext dbc,
                          int rootId,
                          int parentId,
                          int tasktype,
                          CmsUUID ownerId,
                          CmsUUID agentId,
                          CmsUUID roleId,
                          java.lang.String taskname,
                          java.sql.Timestamp wakeuptime,
                          java.sql.Timestamp timeout,
                          int priority)
                   throws CmsDataAccessException
Creates a new task.

Parameters:
dbc - the current database context
rootId - id of the root task project
parentId - id of the parent task
tasktype - type of the task
ownerId - id of the owner
agentId - id of the agent
roleId - id of the role
taskname - name of the task
wakeuptime - time when the task will be wake up
timeout - time when the task times out
priority - priority of the task
Returns:
the Task object of the generated task
Throws:
CmsDataAccessException - if something goes wrong

destroy

public void destroy()
             throws java.lang.Throwable
Destroys this driver.

Throws:
java.lang.Throwable - if something goes wrong

endTask

public void endTask(CmsDbContext dbc,
                    int taskId)
             throws CmsDataAccessException
Ends a task.

Parameters:
dbc - the current database context
taskId - Id of the task to end
Throws:
CmsDataAccessException - if something goes wrong

forwardTask

public void forwardTask(CmsDbContext dbc,
                        int taskId,
                        CmsUUID newRoleId,
                        CmsUUID newUserId)
                 throws CmsDataAccessException
Forwards a task to a new user.

Parameters:
dbc - the current database context
taskId - the Id of the task to forward
newRoleId - the new group name for the task
newUserId - the new user who gets the task
Throws:
CmsDataAccessException - if something goes wrong

getSqlManager

public CmsSqlManager getSqlManager()
Returns the SqlManager of this driver.

Returns:
the SqlManager of this driver

initSqlManager

public CmsSqlManager initSqlManager(java.lang.String classname)
Initializes the SQL manager for this driver.

To obtain JDBC connections from different pools, further {online|offline|backup} pool Urls have to be specified.

Parameters:
classname - the classname of the SQL manager
Returns:
the SQL manager for this driver

readAgent

public CmsUUID readAgent(CmsDbContext dbc,
                         CmsUUID roleId)
                  throws CmsDataAccessException
Finds an agent for a given role (group).

Parameters:
dbc - the current database context
roleId - The Id for the role (group)
Returns:
A vector with the tasks
Throws:
CmsDataAccessException - if something goes wrong

readProject

public CmsProject readProject(CmsDbContext dbc,
                              CmsTask task)
                       throws CmsDataAccessException
Reads a project of a given task.

Parameters:
dbc - the current database context
task - the task to read the project of
Returns:
the project of the task
Throws:
CmsDataAccessException - if something goes wrong

readProjectLogs

public java.util.List readProjectLogs(CmsDbContext dbc,
                                      int projectId)
                               throws CmsDataAccessException
Reads all task log entries for a project.

Parameters:
dbc - the current database context
projectId - the id of the project for which the tasklog will be read
Returns:
a list of CmsTaskLog objects
Throws:
CmsDataAccessException - if something goes wrong

readTask

public CmsTask readTask(CmsDbContext dbc,
                        int id)
                 throws CmsDataAccessException
Reads the task with the given id.

Parameters:
dbc - the current database context
id - the id for the task to read
Returns:
the task with the given id
Throws:
CmsDataAccessException - if something goes wrong

readTaskLog

public CmsTaskLog readTaskLog(CmsDbContext dbc,
                              int id)
                       throws CmsDataAccessException
Reads a log for a task.

Parameters:
dbc - the current database context
id - The id for the tasklog
Returns:
a new TaskLog object
Throws:
CmsDataAccessException - if something goes wrong

readTaskLogs

public java.util.List readTaskLogs(CmsDbContext dbc,
                                   int taskId)
                            throws CmsDataAccessException
Reads log entries for a task.

Parameters:
dbc - the current satabase context
taskId - the task for the tasklog to read
Returns:
a list of CmsTaskLog objects
Throws:
CmsDataAccessException - if something goes wrong

readTaskParameter

public java.lang.String readTaskParameter(CmsDbContext dbc,
                                          int taskId,
                                          java.lang.String parName)
                                   throws CmsDataAccessException
Returns the value of the given parameter for the given task.

Parameters:
dbc - the current database context
taskId - the Id of the task
parName - name of the parameter
Returns:
task parameter value
Throws:
CmsDataAccessException - if something goes wrong

readTasks

public java.util.List readTasks(CmsDbContext dbc,
                                CmsProject project,
                                CmsUser agent,
                                CmsUser owner,
                                CmsGroup role,
                                int taskType,
                                java.lang.String orderBy,
                                java.lang.String sort)
                         throws CmsDataAccessException
Reads all given tasks from a user for a project.

Most parameters can be null, if you do not want to filter the tasks by them. The tasktype parameter will filter the tasks. The possible values for this parameter are:

Parameters:
dbc - the current database context
project - the id of the project in which the tasks are defined
agent - the owner of the task
owner - the owner of the task
role - the owner of the task
taskType - the type of task you want to read
orderBy - specifies how to order the tasks
sort - sorting of the tasks
Returns:
a list of given CmsTask objects for a user for a project
Throws:
CmsDataAccessException - if operation was not successful

readTaskType

public int readTaskType(CmsDbContext dbc,
                        java.lang.String taskName)
                 throws CmsDataAccessException
Get the template task id fo a given taskname.

Parameters:
dbc - the current database context
taskName - Name of the Task
Returns:
id from the task template
Throws:
CmsDataAccessException - if something goes wrong

writeSystemTaskLog

public void writeSystemTaskLog(CmsDbContext dbc,
                               int taskid,
                               java.lang.String comment)
                        throws CmsDataAccessException
Writes a system task log entry.

Parameters:
dbc - the current database context
taskid - the id of the task
comment - the log entry
Throws:
CmsDataAccessException - if something goes wrong

writeTask

public CmsTask writeTask(CmsDbContext dbc,
                         CmsTask task)
                  throws CmsDataAccessException
Writes a task.

Parameters:
dbc - the current database context
task - the task to write
Returns:
written task object
Throws:
CmsDataAccessException - if something goes wrong

writeTaskLog

public void writeTaskLog(CmsDbContext dbc,
                         int taskId,
                         CmsUUID userId,
                         java.sql.Timestamp starttime,
                         java.lang.String comment,
                         int type)
                  throws CmsDataAccessException
Writes new log for a task.

Parameters:
dbc - the current database context
taskId - The id of the task
userId - User who added the Log
starttime - Time when the log is created
comment - Description for the log
type - Type of the log. 0 = Sytem log, 1 = User Log
Throws:
CmsDataAccessException - if something goes wrong

writeTaskParameter

public void writeTaskParameter(CmsDbContext dbc,
                               int taskId,
                               java.lang.String parname,
                               java.lang.String parvalue)
                        throws CmsDataAccessException
Set a Parameter for a task.

Parameters:
dbc - the current database context
taskId - the task
parname - the name of the parameter
parvalue - the value of the parameter
Throws:
CmsDataAccessException - if something goes wrong

writeTaskType

public void writeTaskType(CmsDbContext dbc,
                          int autofinish,
                          int escalationtyperef,
                          java.lang.String htmllink,
                          java.lang.String name,
                          java.lang.String permission,
                          int priorityref,
                          int roleref)
                   throws CmsDataAccessException
Creates a new tasktype set in the database.

Parameters:
dbc - the current database context
autofinish - tbd
escalationtyperef - tbd
htmllink - tbd
name - tbd
permission - tbd
priorityref - tbd
roleref - tbd
Throws:
CmsDataAccessException - if something goes wrong