001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/event/tags/sakai_2-4-1/event-api/api/src/java/org/sakaiproject/event/api/NotificationService.java $
003: * $Id: NotificationService.java 13804 2006-08-17 02:47:37Z ggolden@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2004, 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.event.api;
021:
022: /**
023: * <p>
024: * NotificationService is ...
025: * </p>
026: */
027: public interface NotificationService {
028: /** This string can be used to find the service in the service manager. */
029: static final String SERVICE_NAME = NotificationService.class
030: .getName();
031:
032: /** This string starts the references to resources in this service. */
033: static final String REFERENCE_ROOT = "/notification";
034:
035: /** ability / event for notification add. */
036: static final String SECURE_ADD_NOTIFICATION = "notification.add";
037:
038: /** ability / event for notification update. */
039: static final String SECURE_UPDATE_NOTIFICATION = "notification.update";
040:
041: /** ability / event for notification removal. */
042: static final String SECURE_REMOVE_NOTIFICATION = "notification.remove";
043:
044: /** Notification option value for undefined or no notification. */
045: static final int NOTI_NONE = 0;
046:
047: /** Notification option value for required notification. */
048: static final int NOTI_REQUIRED = 1;
049:
050: /** Notification option value for optional notification. */
051: static final int NOTI_OPTIONAL = 2;
052:
053: /** Notification option value for undefined notification. */
054: static final int PREF_NONE = 0;
055:
056: /** Notification preference value for blocking notification. */
057: static final int PREF_IGNORE = 1;
058:
059: /** Notification preference value for digest notification. */
060: static final int PREF_DIGEST = 2;
061:
062: /** Notification preference value for immediate notification. */
063: static final int PREF_IMMEDIATE = 3;
064:
065: /** Preferences key for default notification prefs. */
066: static final String PREFS_DEFAULT = "noti:default";
067:
068: /** Preferences key for default for a resource type notification prefs - append the resource type. */
069: static final String PREFS_TYPE = "noti:types:";
070:
071: /** Preferences key for default for a site notification prefs - append the site id. */
072: static final String PREFS_SITE = "noti:sites:";
073:
074: /** Preferences key for a specific notification - append the notification id. */
075: static final String PREFS_NOTI = "noti:notis:";
076:
077: /**
078: * Establish a new notification, locked for edit. Must commitEdit() to make official, or cancelEdit() when done!
079: *
080: * @return a new Notification, locked for edit.
081: */
082: NotificationEdit addNotification()
083: /* throws PermissionException */;
084:
085: /**
086: * Establish a new transient notification. Transient notifications are processed by the service but not stored in storage. Modification to the notification can be done at any time, do not use edit(), commit() or remove() on it.
087: *
088: * @return a new transient Notification.
089: */
090: NotificationEdit addTransientNotification();
091:
092: /**
093: * Access a notification object.
094: *
095: * @param id
096: * The notification id string.
097: * @return A notification object containing the notification information.
098: * @exception NotificationNotDefinedException
099: * if not found.
100: */
101: Notification getNotification(String id)
102: throws NotificationNotDefinedException;
103:
104: /**
105: * Get a locked notification object for editing. Must commitEdit() to make official, or cancelEdit() when done!
106: *
107: * @param id
108: * The notification id string.
109: * @return A NotificationEdit object for editing.
110: * @exception NotificationNotDefinedException
111: * if not found.
112: * @exception NotificationLockedException
113: * if the current notification is elsewhere locked for edit.
114: */
115: NotificationEdit editNotification(String id)
116: throws NotificationNotDefinedException,
117: NotificationLockedException;
118:
119: /**
120: * Commit the changes made to a NotificationEdit object, and release the lock. The NotificationEdit is disabled, and not to be used after this call.
121: *
122: * @param notification
123: * The NotificationEdit object to commit.
124: */
125: void commitEdit(NotificationEdit notification);
126:
127: /**
128: * Cancel the changes made to a NotificationEdit object, and release the lock. The NotificationEdit is disabled, and not to be used after this call.
129: *
130: * @param notification
131: * The NotificationEdit object to commit.
132: */
133: void cancelEdit(NotificationEdit notification);
134:
135: /**
136: * Remove this notification - it must be a notification with a lock from editNotification(). The NotificationEdit is disabled, and not to be used after this call.
137: *
138: * @param id
139: * The notification id.
140: * @exception PermissionException
141: * if the current notification does not have permission to remove this notification.
142: */
143: void removeNotification(NotificationEdit notification)
144: /* throws PermissionException */;
145:
146: /**
147: * Access the internal reference which can be used to access the resource from within the system.
148: *
149: * @param id
150: * The notification id.
151: * @return The the internal reference which can be used to access the resource from within the system.
152: */
153: String notificationReference(String id);
154:
155: /**
156: * Find a notification object.
157: *
158: * @param function
159: * The function setting of the notification object.
160: * @param filter
161: * The resourceFilter setting of the notification object.
162: * @return A notification object matching the criteria, or null if none found.
163: */
164: Notification findNotification(String function, String filter);
165:
166: /**
167: * Check if an email notification should be reply-able in the To: field
168: *
169: * @return true if email notifications should be reply-able in the To: field, false if not.
170: */
171: boolean isNotificationToReplyable();
172:
173: /**
174: * Check if an email notification should be reply-able in the From: field
175: *
176: * @return true if email notifications should be reply-able in the From: field, false if not.
177: */
178: boolean isNotificationFromReplyable();
179: }
|