01: package de.webman.acl.eventhandler;
02:
03: import java.util.*;
04:
05: import com.teamkonzept.web.*;
06: import com.teamkonzept.lib.*;
07: import com.teamkonzept.webman.*;
08: import com.teamkonzept.webman.mainint.*;
09: import com.teamkonzept.webman.mainint.events.*;
10: import de.webman.acl.*;
11:
12: /**
13: Deletes a role from the database
14: * @author $Author: alex $
15: * @version $Revision: 1.3 $
16: */
17: public class ACRoleDeleteEventHandler extends DefaultEventHandler
18: implements ParameterTypes, DatabaseDefaults, FrameConstants {
19: private ACRoleDeleteEventHandler() {
20: }
21:
22: private static ACRoleDeleteEventHandler instance = new ACRoleDeleteEventHandler();
23:
24: public static ACRoleDeleteEventHandler getInstance() {
25: return instance;
26: }
27:
28: public void handleEvent(TKEvent evt) throws TKException {
29: try {
30: WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(),
31: ContextConstants.ACCESS_CONTROL);
32:
33: String roleId = evt.getParameter(PARAMETER, "ROLE_ID");
34: if (roleId != null) {
35: Role theRole = RoleFactory.getInstance().getRole(
36: new Integer(roleId));
37: if (theRole != null) {
38: RoleFactory.getInstance().deleteRole(theRole);
39: }
40: }
41: TKHTMLTemplate t = evt
42: .getPrepHTMLTemplate("f_ac_role.tmpl");
43: HTMLUtils.fillFrameSet(t, HTMLUtils.LEFT_FRAME_WIDTH,
44: "AC_ROLE_LIST", "EMPTY");
45: WebManEvent.fillEventsIntoTemplate(evt.getRemoteUser(), t,
46: ACCESS_CONTROL);
47: evt.finishTemplate(t);
48: } catch (Throwable e) {
49: throw WebmanExceptionHandler.getException(e);
50: }
51: }
52:
53: public boolean isHandler(TKEvent evt) {
54: return evt.getName().equalsIgnoreCase("AC_ROLE_DELETE");
55: }
56:
57: }
|