01: package de.webman.acl.db.queries;
02:
03: import java.sql.Connection;
04: import java.sql.Types;
05: import com.teamkonzept.db.*;
06: import com.teamkonzept.webman.mainint.db.queries.accesscontrol.*;
07:
08: /**
09: * $Header: /cvsroot/webman-cms/source/webman/de/webman/acl/db/queries/RoleDelete.java,v 1.2 2001/09/19 11:51:38 markus Exp $
10: *
11: * @author $Author: markus $
12: * @version $Revision: 1.2 $
13: */
14: public class RoleDelete extends TKExtendedPrepQuery {
15:
16: // Constants
17:
18: public static final String[] ORDER = { "WM_ROLE_ID", "WM_ROLE_ID" };
19:
20: public static final Object[][] TYPES = {
21: { "WM_ROLE_ID", new Integer(Types.INTEGER) },
22: { "WM_ROLE_ID", new Integer(Types.INTEGER) } };
23:
24: public static final boolean[] RELEVANTS = { false };
25:
26: // public static final String SQL = (new StringBuffer()).append("DELETE FROM WM_POLICY WHERE WM_ROLE_ID = ? ")
27: // .append("DELETE FROM WM_ROLE WHERE WM_ROLE_ID = ? ")
28: // .toString();
29: //
30: protected static Class[] queryClasses = { DeletePolicy.class,
31: DeleteRole.class };
32:
33: // Method implementations
34:
35: public boolean execute() {
36: try {
37: init(queryClasses); // init query objects
38:
39: Integer roleId = (Integer) queryParams.get("WM_ROLE_ID");
40:
41: boolean isNotOpen = aTKDBConnection.isAutoCommit();
42: if (isNotOpen) {
43: TKDBManager.beginTransaction();
44: }
45:
46: queries[0].setQueryParams("WM_ROLE_ID", roleId);
47: queries[0].execute();
48:
49: queries[1].setQueryParams("WM_ROLE_ID", roleId);
50: queries[1].execute();
51:
52: if (isNotOpen) {
53: aTKDBConnection.commitTransaction(); // commit all changes
54: }
55:
56: } catch (Throwable t) {
57: TKDBManager.safeRollbackTransaction(t);
58: }
59: return hasResults();
60: }
61:
62: public void initQuery(Connection connection) {
63: super
64: .initQuery(connection, true, ORDER, TYPES, RELEVANTS,
65: null);
66: }
67:
68: }
|