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 14 20 public class COPropGroupDeleteHandler extends DefaultEventHandler implements ParameterTypes, DatabaseDefaults, FrameConstants 21 { 22 private COPropGroupDeleteHandler() {} 23 24 private static COPropGroupDeleteHandler instance = new COPropGroupDeleteHandler(); 25 26 public static COPropGroupDeleteHandler 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); String propGroupId = evt.getParameter(PARAMETER, "PROPGROUP_ID"); 36 String propGroupName = evt.getParameter(PARAMETER, "PROPGROUP_NAME"); 37 propGroupId = (propGroupId != null ? propGroupId : "-1"); 38 if ( ! propGroupId.equals("-1")) 39 { 40 TKQuery q = TKDBManager.newQuery(TKDBPropGroupGetGroupProps.class); 42 q.setQueryParams("PROPGROUP_ID", new Integer (propGroupId)); 43 q.execute(); 44 ResultSet rs = q.fetchResultSet(); 45 46 while (rs != null && rs.next()) 48 { 49 q = TKDBManager.newQuery(TKDBPropDelete.class); 50 q.setQueryParams( "PROP_ID", new Integer (rs.getInt("PROP_ID")) ); 51 q.execute(); 52 } 53 54 q = TKDBManager.newQuery(TKDBPropGroupDelete.class); 56 q.setQueryParams( "PROPGROUP_ID", new Integer (propGroupId) ); 57 q.execute(); 58 59 ConfigurationManager.getInstance().notifyListeners(propGroupName); 61 } 62 63 TKHTMLTemplate t = evt.getPrepHTMLTemplate( "f_co_propgroup.tmpl" ); 64 HTMLUtils.fillFrameSet( t, LEFT_FRAME_WIDTH, "CO_PROPGROUP_LIST", "EMPTY" ); 65 evt.finishTemplate( t ); 66 } catch (Throwable e) { 67 throw WebmanExceptionHandler.getException(e); 68 } 69 } 70 71 public boolean isHandler(TKEvent evt) 72 { 73 return evt.getName().equalsIgnoreCase( "CO_PROPGROUP_DELETE" ); 74 } 75 76 } 77 | Popular Tags |