KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > config > eventhandler > COPropDeleteHandler


1 package de.webman.config.eventhandler;
2
3 import java.util.*;
4 import java.sql.*;
5
6 import com.teamkonzept.web.*;
7 import com.teamkonzept.lib.*;
8 import com.teamkonzept.db.*;
9 import com.teamkonzept.webman.*;
10 import com.teamkonzept.webman.mainint.*;
11 import com.teamkonzept.webman.mainint.db.queries.*;
12 import com.teamkonzept.webman.mainint.events.*;
13 import de.webman.config.eventhandler.COPropUpdateHandler;
14
15 /**
16  * Displays a frameset with a list of users on the left and an empty page to the right
17  * @author $Author: uli $
18  * @version $Revision: 1.4 $
19 */

20 public class COPropDeleteHandler extends DefaultEventHandler implements ParameterTypes, DatabaseDefaults, FrameConstants
21 {
22     private COPropDeleteHandler() {}
23
24     private static COPropDeleteHandler instance = new COPropDeleteHandler();
25
26     public static COPropDeleteHandler getInstance()
27     {
28     return instance;
29     }
30
31     public void handleEvent(TKEvent evt) throws TKException
32     {
33         try {
34             WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(), ContextConstants.CUSTOMIZE_PROPERTIES); // check if event is allowed
35
String JavaDoc propId = evt.getParameter( PARAMETER, "PROP_ID" );
36             String JavaDoc propGroupId = evt.getParameter(PARAMETER, "PROPGROUP_ID");
37             String JavaDoc propGroupName = evt.getParameter(PARAMETER, "PROPGROUP_NAME");
38             TKQuery q = null;
39             propId = (propId != null ? propId : "-1");
40 // propGroupId = (propGroupId != null ? propGroupId : "-1");
41

42
43 // // ziehen der propgroup_id, wenn nicht mitgegeben; für hinterher
44
// if ( propGroupId.equals("-1") )
45
// {
46
// q = TKDBManager.newQuery(TKDBPropGetGroups.class);
47
// q.setQueryParams("PROP_ID", new Integer(propId));
48
// q.execute();
49
// ResultSet rs = q.fetchResultSet();
50
// if (rs != null)
51
// {
52
// while (rs.next())
53
// {
54
// if (rs.getInt("PROP_ID") > -1) propGroupId = rs.getString("PROPGROUP_ID");
55
// }
56
// }
57
// propGroupId = (propGroupId != null ? propGroupId : "-1");
58
// }
59

60             // löschen
61
if ( ! (propId.equals("-1")) )
62             {
63                 q = TKDBManager.newQuery(TKDBPropDelete.class);
64                 q.setQueryParams( "PROP_ID", new Integer JavaDoc(propId) );
65                 q.execute();
66
67                 // Notify listeners.
68
ConfigurationManager.getInstance().notifyListeners(propGroupName);
69             }
70
71             // weiter gehts
72
evt.getParams().put(PARAMETER, "PROPGROUP_ID", propGroupId);
73             evt.getParams().put(PARAMETER, "PROPGROUP_NAME", propGroupName);
74             evt.getParams().put(PARAMETER, "LIST_PROPS", "1");
75             COPropGroupEditHandler.getInstance().handleEvent(evt);
76
77
78             /* alte version
79
80             TKHTMLTemplate t = evt.getPrepHTMLTemplate( "f_co_prop.tmpl" );
81             HTMLUtils.fillFrameSet( t, LEFT_FRAME_WIDTH, "CO_PROP_LIST", "EMPTY" );
82             WebManEvent.fillEventsIntoTemplate(evt, t, CUSTOMIZE_PROPERTIES);
83             evt.finishTemplate( t );
84             */

85         } catch (Throwable JavaDoc e) {
86             throw WebmanExceptionHandler.getException(e);
87         }
88     }
89
90     public boolean isHandler(TKEvent evt)
91     {
92         return evt.getName().equalsIgnoreCase( "CO_PROP_DELETE" );
93     }
94
95 }
96
Popular Tags