KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > db > I_CmsWorkflowDriver


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/db/I_CmsWorkflowDriver.java,v $
3  * Date : $Date: 2005/06/27 23:22:09 $
4  * Version: $Revision: 1.29 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.db;
33
34 import org.opencms.db.generic.CmsSqlManager;
35 import org.opencms.file.CmsDataAccessException;
36 import org.opencms.file.CmsGroup;
37 import org.opencms.file.CmsProject;
38 import org.opencms.file.CmsUser;
39 import org.opencms.util.CmsUUID;
40 import org.opencms.workflow.CmsTask;
41 import org.opencms.workflow.CmsTaskLog;
42
43 import java.util.List JavaDoc;
44
45 /**
46  * Definitions of all required workflow driver methods. <p>
47  *
48  * @author Thomas Weckert
49  * @author Michael Emmerich
50  *
51  * @version $Revision: 1.29 $
52  *
53  * @since 6.0.0
54  */

55 public interface I_CmsWorkflowDriver {
56
57     /** The type ID to identify workflow driver implementations. */
58     int DRIVER_TYPE_ID = 4;
59
60     /**
61      * Creates a new task.<p>
62      *
63      * @param dbc the current database context
64      * @param rootId id of the root task project
65      * @param parentId id of the parent task
66      * @param tasktype type of the task
67      * @param ownerId id of the owner
68      * @param agentId id of the agent
69      * @param roleId id of the role
70      * @param taskname name of the task
71      * @param wakeuptime time when the task will be wake up
72      * @param timeout time when the task times out
73      * @param priority priority of the task
74      *
75      * @return the Task object of the generated task
76      *
77      * @throws CmsDataAccessException if something goes wrong
78      */

79     CmsTask createTask(
80         CmsDbContext dbc,
81         int rootId,
82         int parentId,
83         int tasktype,
84         CmsUUID ownerId,
85         CmsUUID agentId,
86         CmsUUID roleId,
87         String JavaDoc taskname,
88         java.sql.Timestamp JavaDoc wakeuptime,
89         java.sql.Timestamp JavaDoc timeout,
90         int priority) throws CmsDataAccessException;
91
92     /**
93      * Destroys this driver.<p>
94      *
95      * @throws Throwable if something goes wrong
96      */

97     void destroy() throws Throwable JavaDoc;
98
99     /**
100      * Ends a task.<p>
101      *
102      * @param dbc the current database context
103      * @param taskId Id of the task to end
104      *
105      * @throws CmsDataAccessException if something goes wrong
106      */

107     void endTask(CmsDbContext dbc, int taskId) throws CmsDataAccessException;
108
109     /**
110      * Forwards a task to a new user.<p>
111      *
112      * @param dbc the current database context
113      * @param taskId the Id of the task to forward
114      * @param newRoleId the new group name for the task
115      * @param newUserId the new user who gets the task
116      *
117      * @throws CmsDataAccessException if something goes wrong
118      */

119     void forwardTask(CmsDbContext dbc, int taskId, CmsUUID newRoleId, CmsUUID newUserId) throws CmsDataAccessException;
120
121     /**
122      * Returns the SqlManager of this driver.<p>
123      *
124      * @return the SqlManager of this driver
125      */

126     CmsSqlManager getSqlManager();
127
128     /**
129      * Initializes the SQL manager for this driver.<p>
130      *
131      * To obtain JDBC connections from different pools, further
132      * {online|offline|backup} pool Urls have to be specified.<p>
133      *
134      * @param classname the classname of the SQL manager
135      *
136      * @return the SQL manager for this driver
137      */

138     org.opencms.db.generic.CmsSqlManager initSqlManager(String JavaDoc classname);
139
140     /**
141      * Finds an agent for a given role (group).<p>
142      *
143      * @param dbc the current database context
144      * @param roleId The Id for the role (group)
145      *
146      * @return A vector with the tasks
147      *
148      * @throws CmsDataAccessException if something goes wrong
149      */

150     CmsUUID readAgent(CmsDbContext dbc, CmsUUID roleId) throws CmsDataAccessException;
151
152     /**
153      * Reads a project of a given task.<p>
154      *
155      * @param dbc the current database context
156      * @param task the task to read the project of
157      *
158      * @return the project of the task
159      *
160      * @throws CmsDataAccessException if something goes wrong
161      */

162     CmsProject readProject(CmsDbContext dbc, CmsTask task) throws CmsDataAccessException;
163
164     /**
165      * Reads all task log entries for a project.
166      *
167      * @param dbc the current database context
168      * @param projectId the id of the project for which the tasklog will be read
169      *
170      * @return a list of <code>{@link CmsTaskLog}</code> objects
171      *
172      * @throws CmsDataAccessException if something goes wrong
173      */

174     List JavaDoc readProjectLogs(CmsDbContext dbc, int projectId) throws CmsDataAccessException;
175
176     /**
177      * Reads the task with the given id.<p>
178      *
179      * @param dbc the current database context
180      * @param id the id for the task to read
181      *
182      * @return the task with the given id
183      *
184      * @throws CmsDataAccessException if something goes wrong
185      */

186     CmsTask readTask(CmsDbContext dbc, int id) throws CmsDataAccessException;
187
188     /**
189      * Reads a log for a task.<p>
190      *
191      * @param dbc the current database context
192      * @param id The id for the tasklog
193      *
194      * @return a new TaskLog object
195      * @throws CmsDataAccessException if something goes wrong
196      */

197     CmsTaskLog readTaskLog(CmsDbContext dbc, int id) throws CmsDataAccessException;
198
199     /**
200      * Reads log entries for a task.<p>
201      *
202      * @param dbc the current satabase context
203      * @param taskId the task for the tasklog to read
204      *
205      * @return a list of <code>{@link CmsTaskLog}</code> objects
206      *
207      * @throws CmsDataAccessException if something goes wrong
208      */

209     List JavaDoc readTaskLogs(CmsDbContext dbc, int taskId) throws CmsDataAccessException;
210
211     /**
212      * Returns the value of the given parameter for the given task.<p>
213      *
214      * @param dbc the current database context
215      * @param taskId the Id of the task
216      * @param parName name of the parameter
217      *
218      * @return task parameter value
219      *
220      * @throws CmsDataAccessException if something goes wrong
221      */

222     String JavaDoc readTaskParameter(CmsDbContext dbc, int taskId, String JavaDoc parName) throws CmsDataAccessException;
223
224     /**
225      * Reads all given tasks from a user for a project.<p>
226      *
227      * Most parameters can be <code>null</code>,
228      * if you do not want to filter the tasks by them.
229      *
230      * The <code>tasktype</code> parameter will filter the tasks.
231      * The possible values for this parameter are:<br>
232      * <ul>
233      * <il><code>{@link org.opencms.workflow.CmsTaskService#TASKS_ALL}</code>: Reads all tasks</il>
234      * <il><code>{@link org.opencms.workflow.CmsTaskService#TASKS_OPEN}</code>: Reads all open tasks</il>
235      * <il><code>{@link org.opencms.workflow.CmsTaskService#TASKS_DONE}</code>: Reads all finished tasks</il>
236      * <il><code>{@link org.opencms.workflow.CmsTaskService#TASKS_NEW}</code>: Reads all new tasks</il>
237      * </ul>
238      *
239      * @param dbc the current database context
240      * @param project the id of the project in which the tasks are defined
241      * @param agent the owner of the task
242      * @param owner the owner of the task
243      * @param role the owner of the task
244      * @param taskType the type of task you want to read
245      * @param orderBy specifies how to order the tasks
246      * @param sort sorting of the tasks
247      *
248      * @return a list of given <code>{@link CmsTask}</code> objects for a user for a project
249      *
250      * @throws CmsDataAccessException if operation was not successful
251      */

252     List JavaDoc readTasks(
253         CmsDbContext dbc,
254         CmsProject project,
255         CmsUser agent,
256         CmsUser owner,
257         CmsGroup role,
258         int taskType,
259         String JavaDoc orderBy,
260         String JavaDoc sort) throws CmsDataAccessException;
261
262     /**
263      * Get the template task id fo a given taskname.<p>
264      *
265      * @param dbc the current database context
266      * @param taskName Name of the Task
267      *
268      * @return id from the task template
269      *
270      * @throws CmsDataAccessException if something goes wrong
271      */

272     int readTaskType(CmsDbContext dbc, String JavaDoc taskName) throws CmsDataAccessException;
273
274     /**
275      * Writes a system task log entry.<p>
276      *
277      * @param dbc the current database context
278      * @param taskid the id of the task
279      * @param comment the log entry
280      *
281      * @throws CmsDataAccessException if something goes wrong
282      */

283     void writeSystemTaskLog(CmsDbContext dbc, int taskid, String JavaDoc comment) throws CmsDataAccessException;
284
285     /**
286      * Writes a task.<p>
287      *
288      * @param dbc the current database context
289      * @param task the task to write
290      *
291      * @return written task object
292      * @throws CmsDataAccessException if something goes wrong
293      */

294     CmsTask writeTask(CmsDbContext dbc, CmsTask task) throws CmsDataAccessException;
295
296     /**
297      * Writes new log for a task.<p>
298      *
299      * @param dbc the current database context
300      * @param taskId The id of the task
301      * @param userId User who added the Log
302      * @param starttime Time when the log is created
303      * @param comment Description for the log
304      * @param type Type of the log. 0 = Sytem log, 1 = User Log
305      *
306      * @throws CmsDataAccessException if something goes wrong
307      */

308     void writeTaskLog(
309         CmsDbContext dbc,
310         int taskId,
311         CmsUUID userId,
312         java.sql.Timestamp JavaDoc starttime,
313         String JavaDoc comment,
314         int type) throws CmsDataAccessException;
315
316     /**
317      * Set a Parameter for a task.<p>
318      *
319      * @param dbc the current database context
320      * @param taskId the task
321      * @param parname the name of the parameter
322      * @param parvalue the value of the parameter
323      *
324      * @throws CmsDataAccessException if something goes wrong
325      */

326     void writeTaskParameter(CmsDbContext dbc, int taskId, String JavaDoc parname, String JavaDoc parvalue) throws CmsDataAccessException;
327
328     /**
329      * Creates a new tasktype set in the database.<p>
330      *
331      * @param dbc the current database context
332      * @param autofinish tbd
333      * @param escalationtyperef tbd
334      * @param htmllink tbd
335      * @param name tbd
336      * @param permission tbd
337      * @param priorityref tbd
338      * @param roleref tbd
339      *
340      * @throws CmsDataAccessException if something goes wrong
341      */

342     void writeTaskType(
343         CmsDbContext dbc,
344         int autofinish,
345         int escalationtyperef,
346         String JavaDoc htmllink,
347         String JavaDoc name,
348         String JavaDoc permission,
349         int priorityref,
350         int roleref) throws CmsDataAccessException;
351
352 }
Popular Tags