01: package org.tigris.scarab.notification;
02:
03: import java.util.Set;
04:
05: import org.tigris.scarab.om.ActivitySet;
06: import org.tigris.scarab.om.ScarabUser;
07: import org.tigris.scarab.notification.ActivityType;
08: import org.tigris.scarab.om.Issue;
09: import org.tigris.scarab.util.EmailContext;
10:
11: /**
12: * The Notification Manager is meant to be the central service to provide notifications
13: * related with the usual flow of activities in Scarab.
14: * It has essentially two functions:
15: * <ul>
16: * <li>To allow the system to <b>create notifications</b> regarding activity in the issues.</li>
17: * <li>To process the notifications so that they arrive to the involved users.</li>
18: * </ul>
19: * <p>
20: * The simpler notification manager implementation might directly send emails to the involved users in
21: * the moment the notifications are created.<br/>
22: * </p>
23: * <p>
24: * A slightly improved implementation will be able to:
25: * <ul>
26: * <li><b>Filter the events</b> to decide if each involved user should be notified or not (basing the decision
27: * on user-preferences, globa-preferences, whatever...</li>
28: * <li><b>Aggregate pending notifications</b> (probably consolidating on issue and user to be notified) so the
29: * user will only get one notification for every bunch of changes done in an issue (at least in a given
30: * interval of time)</li>
31: * </ul>
32: * </p>
33: * The real implementation of this interface to be
34: * instantiated is defined by scarab.notificationmanager.classname property
35: * (defaults to ScarabNotificationManager)<br>
36: * This interface also holds the
37: * constants defining the different types of events in the system.
38: *
39: * @see org.tigris.scarab.notification.NotificationManagerFactory
40: * @author jorgeuriarte
41: */
42: public interface NotificationManager {
43:
44: /**
45: * This method should add a notification to be processed. It must decide if
46: * the activities are relevant to the recipients and filter acordingly.
47: *
48: * @see addActivityNotification(NotificationEvent, EmailContext,
49: * ActivitySet, Issue, Set, Set)
50: * @param event
51: * The event that originated the notification
52: * @param activitySet
53: * The activity set describing the event
54: * @param issue
55: * The issue affected by the event
56: * @param fromUser TODO
57: * @see #addActivityNotification(NotificationEvent, EmailContext, ActivitySet, Issue, Set, Set)
58: */
59: public void addActivityNotification(ActivityType event,
60: ActivitySet activitySet, Issue issue, ScarabUser fromUser);
61:
62: /**
63: * Long version of the addActivityNotification method, allowing to pass the sets of
64: * users involved as 'To' or 'CC'.
65: *
66: * @param event
67: * The event that originated the notification
68: * @param activitySet
69: * The activity set describing the event
70: * @param issue
71: * The issue affected by the event
72: * @param toUsers
73: * List of users intended to be notified as 'To:'
74: * @param ccUsers
75: * List of users intended to be notified in 'CC:'
76: * @param fromUser TODO
77: * @see #addActivityNotification(NotificationEvent, ActivitySet, Issue, ScarabUser)
78: */
79: public void addActivityNotification(ActivityType event,
80: ActivitySet activitySet, Issue issue, Set toUsers,
81: Set ccUsers, ScarabUser fromUser);
82:
83: /**
84: * Implementations of this method should provide the means to send the
85: * pending notifications. Only makes sense when the implementation is
86: * 'offline', probably calling regularly to this method.
87: */
88: public void sendPendingNotifications();
89:
90: /**
91: * Each manager has its own id (Which happens to be
92: * a small integer value.
93: * @return
94: */
95: public Integer getManagerId();
96:
97: }
|