01: /*
02: JSPWiki - a JSP-based WikiWiki clone.
03:
04: Copyright (C) 2001-2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)
05:
06: This program is free software; you can redistribute it and/or modify
07: it under the terms of the GNU Lesser General Public License as published by
08: the Free Software Foundation; either version 2.1 of the License, or
09: (at your option) any later version.
10:
11: This program is distributed in the hope that it will be useful,
12: but WITHOUT ANY WARRANTY; without even the implied warranty of
13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: GNU Lesser General Public License for more details.
15:
16: You should have received a copy of the GNU Lesser General Public License
17: along with this program; if not, write to the Free Software
18: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20: package com.ecyrd.jspwiki.workflow;
21:
22: import java.security.Principal;
23:
24: import com.ecyrd.jspwiki.WikiException;
25:
26: /**
27: * Decision subclass used for notifications that includes only one available Outcome:
28: * {@link Outcome#DECISION_ACKNOWLEDGE}. The Decision is not reassignable, and
29: * the default Outcome is {@link Outcome#DECISION_ACKNOWLEDGE}.
30: *
31: * @author Andrew Jaquith
32: * @since 2.5
33: */
34: public final class SimpleNotification extends Decision {
35:
36: /**
37: * Constructs a new SimpleNotification object with a supplied message key,
38: * associated Workflow, and named actor who must acknowledge the message.
39: * The notification is placed in the Principal's list of queued Decisions.
40: * Because the only available Outcome is
41: * {@link Outcome#DECISION_ACKNOWLEDGE}, the actor can only acknowledge the
42: * message.
43: *
44: * @param workflow
45: * the Workflow to associate this notification with
46: * @param messageKey
47: * the message key
48: * @param actor
49: * the Principal who will acknowledge the message
50: */
51: public SimpleNotification(Workflow workflow, String messageKey,
52: Principal actor) {
53: super (workflow, messageKey, actor, Outcome.DECISION_ACKNOWLEDGE);
54: }
55:
56: /**
57: * Convenience method that simply calls {@link #decide(Outcome)}
58: * with the value {@link Outcome#DECISION_ACKNOWLEDGE}.
59: * @throws WikiException never
60: */
61: public void acknowledge() throws WikiException {
62: this .decide(Outcome.DECISION_ACKNOWLEDGE);
63: }
64:
65: /**
66: * Notifications cannot be re-assigned, so this method always returns
67: * <code>false</code>.
68: * @return <code>false</code> always
69: */
70: public final boolean isReassignable() {
71: return false;
72: }
73:
74: }
|