01: package de.webman.acl.db.queries;
02:
03: import java.sql.Connection;
04: import java.sql.Types;
05: import java.sql.SQLException;
06: import java.sql.ResultSet;
07: import com.teamkonzept.db.*;
08: import com.teamkonzept.webman.mainint.db.queries.accesscontrol.*;
09: import com.teamkonzept.webman.mainint.WebmanExceptionHandler;
10:
11: /**
12: * $Header: /cvsroot/webman-cms/source/webman/de/webman/acl/db/queries/TaskDelete.java,v 1.2 2001/09/19 11:51:38 markus Exp $
13: *
14: * @version 0.10
15: * @since 0.10
16: * @author © 2000 Team-Konzept
17: */
18: public class TaskDelete extends TKExtendedPrepQuery {
19:
20: // Constants
21:
22: public static final String[] ORDER = { "WM_TASK_ID", "WM_TASK_ID" };
23:
24: public static final Object[][] TYPES = {
25: { "WM_TASK_ID", new Integer(Types.INTEGER) },
26: { "WM_TASK_ID", new Integer(Types.INTEGER) } };
27:
28: public static final boolean[] RELEVANTS = { false };
29:
30: /* public static final String SQL = (new StringBuffer()).append("DELETE FROM WM_ROLE_TASK WHERE WM_TASK_ID = ? ")
31: .append("DELETE FROM WM_TASK WHERE WM_TASK_ID = ?")
32: .toString(); */
33:
34: public static final String SQL = null;
35:
36: protected static Class[] queryClasses = { DeleteWMRoleTask.class,
37: DeleteWMRole.class };
38:
39: // Method implementations
40:
41: public boolean execute() {
42: try {
43: init(queryClasses);
44:
45: boolean isNotOpen = aTKDBConnection.isAutoCommit();
46: if (isNotOpen) {
47: aTKDBConnection.beginTransaction();
48: }
49:
50: queries[0].setQueryParams("WM_TASK_ID", queryParams
51: .get("WM_TASK_ID"));
52: queries[0].execute(); // execute first query
53: queries[1].setQueryParams("WM_TASK_ID", queryParams
54: .get("WM_TASK_ID"));
55: queries[1].execute(); // ...and execute it
56:
57: if (isNotOpen) {
58: aTKDBConnection.commitTransaction();
59: }
60:
61: } catch (SQLException sqle) {
62: WebmanExceptionHandler.getException(sqle);
63: try {
64: aTKDBConnection.rollbackTransaction();
65: } catch (SQLException sqle2) {
66: WebmanExceptionHandler.getException(sqle2);
67: }
68: } finally {
69: return hasResults();
70: }
71: }
72:
73: public void initQuery(Connection connection) {
74: super .initQuery(connection, true, ORDER, TYPES, RELEVANTS, SQL);
75: }
76:
77: }
|