KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > acl > db > queries > RoleDelete


1 package de.webman.acl.db.queries;
2
3 import java.sql.Connection JavaDoc;
4 import java.sql.Types JavaDoc;
5 import com.teamkonzept.db.*;
6 import com.teamkonzept.webman.mainint.db.queries.accesscontrol.*;
7
8 /**
9  * $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
15     extends TKExtendedPrepQuery
16 {
17
18     // Constants
19

20     public static final String JavaDoc[] ORDER =
21     {
22         "WM_ROLE_ID",
23         "WM_ROLE_ID"
24     };
25
26     public static final Object JavaDoc[][] TYPES =
27     {
28         {"WM_ROLE_ID", new Integer JavaDoc(Types.INTEGER)},
29         {"WM_ROLE_ID", new Integer JavaDoc(Types.INTEGER)}
30     };
31
32     public static final boolean[] RELEVANTS =
33     {
34         false
35     };
36
37 // public static final String SQL = (new StringBuffer()).append("DELETE FROM WM_POLICY WHERE WM_ROLE_ID = ? ")
38
// .append("DELETE FROM WM_ROLE WHERE WM_ROLE_ID = ? ")
39
// .toString();
40
//
41
protected static Class JavaDoc[] queryClasses = {
42     DeletePolicy.class,
43     DeleteRole.class
44     };
45
46
47     // Method implementations
48

49     public boolean execute()
50     {
51     try
52     {
53         init(queryClasses); // init query objects
54

55         Integer JavaDoc roleId =
56         (Integer JavaDoc) queryParams.get("WM_ROLE_ID");
57
58         boolean isNotOpen = aTKDBConnection.isAutoCommit();
59         if (isNotOpen)
60         {
61         TKDBManager.beginTransaction();
62         }
63
64         queries[0].setQueryParams("WM_ROLE_ID", roleId);
65         queries[0].execute();
66
67         queries[1].setQueryParams("WM_ROLE_ID", roleId);
68         queries[1].execute();
69         
70         if (isNotOpen)
71         {
72         aTKDBConnection.commitTransaction(); // commit all changes
73
}
74
75     }
76     catch(Throwable JavaDoc t)
77     {
78         TKDBManager.safeRollbackTransaction(t);
79     }
80     return hasResults();
81     }
82     public void initQuery (Connection JavaDoc connection)
83     {
84         super.initQuery(connection,
85                         true,
86                         ORDER,
87                         TYPES,
88                         RELEVANTS,
89                         null);
90     }
91
92 }
93
Popular Tags