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 task definition from the database
14: * @author $Author: alex $
15: * @version $Revision: 1.3 $
16: */
17: public class ACTaskDeleteEventHandler extends DefaultEventHandler
18: implements ParameterTypes, DatabaseDefaults, FrameConstants {
19: private ACTaskDeleteEventHandler() {
20: }
21:
22: private static ACTaskDeleteEventHandler instance = new ACTaskDeleteEventHandler();
23:
24: public static ACTaskDeleteEventHandler 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: String taskId = evt.getParameter(PARAMETER, "TASK_ID");
33: if (taskId != null) {
34: Task theTask = TaskFactory.getInstance().getTask(
35: new Integer(taskId));
36: if (theTask != null) {
37: TaskFactory.getInstance().deleteTask(theTask);
38: }
39: }
40:
41: TKHTMLTemplate t = evt
42: .getPrepHTMLTemplate("f_ac_task.tmpl");
43: HTMLUtils.fillFrameSet(t, HTMLUtils.LEFT_FRAME_WIDTH,
44: "AC_TASK_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_TASK_DELETE");
55: }
56:
57: }
|