01: /**
02: * $Id: TaskDeleteTag.java,v 1.9 2005/09/21 10:51:14 dg154973 Exp $
03: * Copyright 2003 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.wireless.taglibs.cal;
14:
15: import java.util.*;
16: import java.util.logging.Logger;
17: import java.util.logging.Level;
18: import javax.servlet.jsp.*;
19: import javax.servlet.jsp.tagext.*;
20:
21: import com.sun.comclient.calendar.ICalendar;
22: import com.sun.comclient.calendar.CalendarException;
23:
24: import com.sun.portal.wireless.taglibs.base.Util;
25: import com.sun.portal.log.common.PortalLogger;
26:
27: /**
28: * TaskDeleteTag - execute a delete operation on an Task object
29: *
30: * <b>Attributes:</b>
31: * <ul>
32: * <li>name</li>
33: * <ul><li>the Task object to operate on; or parent TaskTag</ul></li>
34: *
35: * <li>modifier</li>
36: * <ul><li>the task modifier; defaults to Task.THISINSTANCE</ul></li>
37: * </ul>
38: * @version 6.0
39: * @since 6.0
40: */
41:
42: public class TaskDeleteTag extends TaskCommandTag {
43:
44: // Create a logger for this class
45: private static Logger debugLogger = PortalLogger
46: .getLogger(TaskDeleteTag.class);
47:
48: /**
49: * the default constructor
50: */
51: public TaskDeleteTag() {
52: super ();
53: }
54:
55: /**
56: * Execute the delete operation of the Task
57: * <br><br>
58: * @return true if deletion is successful
59: * @exception JspException
60: */
61:
62: public boolean execute() throws JspException {
63:
64: ICalendar calendar = getCalendar();
65: TaskBean task = findTask();
66:
67: if (calendar == null) {
68: throw new JspException(
69: "TaskDeleteTag.execute(): no Calendar found");
70: }
71:
72: if (task == null) {
73: throw new JspException(
74: "TaskDeleteTag.execute(): no Task found or specified");
75: }
76:
77: String modifierval = getModifierValue(task);
78: if (modifierval == null) {
79: throw new JspException(
80: "TaskDeleteTag.execute(): invalid modifier attribute: "
81: + modifierval);
82: }
83:
84: try {
85: calendar.deleteTodo(task.getTask(), modifierval, true);
86: } catch (Exception ce) {
87: debugLogger.log(Level.INFO, "PSMA_CSPWTC0011", ce);
88: }
89: return true;
90: }
91: }
|