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