KickJava   Java API By Example, From Geeks To Geeks.

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


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

23     public static final String JavaDoc[] ORDER =
24     {
25         "WM_ACTION_ID",
26         "WM_ACTION_ID"
27     };
28
29     public static final Object JavaDoc[][] TYPES =
30     {
31         {"WM_ACTION_ID", new Integer JavaDoc(Types.INTEGER)},
32         {"WM_ACTION_ID", new Integer JavaDoc(Types.INTEGER)}
33     };
34
35     public static final boolean[] RELEVANTS =
36     {
37         false
38     };
39
40 // public static final String SQL = (new StringBuffer()).append("DELETE FROM WM_TASK_ACTION WHERE WM_ACTION_ID = ? ")
41
// .append("DELETE FROM WM_ACTION WHERE WM_ACTION_ID = ?")
42
// .toString();
43

44     protected static Class JavaDoc[] queryClasses = {DeleteWMTaskAction.class, DeleteWMAction.class};
45
46
47     // Method implementations
48

49   public boolean execute() {
50     try {
51         init(queryClasses);
52         boolean isNotOpen = aTKDBConnection.isAutoCommit();
53         if (isNotOpen) {
54             aTKDBConnection.beginTransaction();
55         }
56
57         queries[0].setQueryParams("WM_ACTION_ID", queryParams.get("WM_ACTION_ID"));
58         queries[0].execute();
59
60         queries[1].setQueryParams("WM_ACTION_ID", queryParams.get("WM_ACTION_ID"));
61         queries[1].execute();
62
63         if (isNotOpen) {
64           aTKDBConnection.commitTransaction();
65         }
66     }
67     catch (SQLException JavaDoc sqle) {
68       WebmanExceptionHandler.getException(sqle);
69       try {
70         aTKDBConnection.rollbackTransaction();
71       }
72       catch (SQLException JavaDoc sqle2) {
73         WebmanExceptionHandler.getException(sqle2);
74       }
75     }
76     finally {
77         return hasResults();
78     }
79   }
80
81     public void initQuery (Connection JavaDoc connection)
82     {
83         super.initQuery(connection,
84                         true,
85                         ORDER,
86                         TYPES,
87                         RELEVANTS,
88                         null);
89     }
90
91 }
92
Popular Tags