001 /*
002 * Copyright 2007 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.ken.util;
017
018 import org.kuali.rice.ken.bo.NotificationProducer;
019 import org.kuali.rice.kew.util.KEWConstants;
020
021
022 /**
023 * This class houses all constants for the NotificationSystem.
024 * @author Kuali Rice Team (rice.collab@kuali.org)
025 */
026 public class NotificationConstants {
027 /**
028 * This inner class holds contants that are used for parsing and resolving of content
029 * inside of the XML message format that represents a notification request.
030 * @author Kuali Rice Team (rice.collab@kuali.org)
031 */
032 public static final class XML_MESSAGE_CONSTANTS {
033 public static final String MESSAGE_OPEN = "<message><![CDATA[";
034 public static final String MESSAGE_CLOSE = "]]></message>";
035 public static final String CONTENT_SIMPLE_OPEN = "<content xmlns=\"ns:notification/ContentTypeSimple\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"ns:notification/ContentTypeSimple resource:notification/ContentTypeSimple\">";
036 public static final String CONTENT_EVENT_OPEN = "<content xmlns=\"ns:notification/ContentTypeEvent\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"ns:notification/ContentTypeEvent resource:notification/ContentTypeEvent\">";
037 public static final String CONTENT_CLOSE = "</content>";
038 }
039
040 /**
041 * Different content types for the Notification System. These are static out of the box content types that have specific UIs built for them.
042 * @author Kuali Rice Team (rice.collab@kuali.org)
043 */
044 public static final class CONTENT_TYPES {
045 public static final String EVENT_CONTENT_TYPE = "Event";
046 public static final String SIMPLE_CONTENT_TYPE = "Simple";
047 }
048
049 /**
050 * Different delivery types for the Notification System.
051 * FYI - user gets notification in list, but can remove without actually viewing details and taking action
052 * ACK - user gets notification in list, but has to view details and conciously press the acknowledge button
053 * @author Kuali Rice Team (rice.collab@kuali.org)
054 */
055 public static final class DELIVERY_TYPES {
056 public static final String FYI = "FYI";
057 public static final String ACK = "ACK";
058 }
059
060 /**
061 * String that indicates the cause of a dismissal of a messageDelivery was
062 * due to autoremoval
063 */
064 public static final String AUTO_REMOVE_CAUSE = "autoremove";
065 public static final String ACK_CAUSE = "ack";
066 public static final String FYI_CAUSE = "fyi";
067
068 /**
069 * This class holds constants for different detail views of a notification.
070 * INLINE - display the details inline (i.e. without any menus around them)
071 * NORMAL_VIEW - display the details in a normal view with all of the appropriate menus
072 * @author Kuali Rice Team (rice.collab@kuali.org)
073 */
074 public static final class NOTIFICATION_DETAIL_VIEWS {
075 public static final String NORMAL_VIEW = "displayActionListView";
076 public static final String INLINE = "displayActionListInlineView";
077 public static final String DOC_SEARCH_VIEW = "displayDocSearchView";
078 }
079
080 /**
081 * Constants for request processing (web layer).
082 * @author Kuali Rice Team (rice.collab@kuali.org)
083 */
084 public static final class NOTIFICATION_CONTROLLER_CONSTANTS {
085 public static final String MSG_DELIVERY_ID = "messageDeliveryId";
086 public static final String DELIVERER_ID = "delivererId";
087 public static final String DOC_ID = "docId";
088 public static final String COMMAND = "command";
089 public static final String STANDALONE_WINDOW = "standaloneWindow";
090 }
091
092 /**
093 * Different delivery status flags for the notification system.
094 * UNDELIVERED - the notification has not been delivered by the delivery machine
095 * DELIVERED - the notification has been delivered by the delivery machine
096 * REMOVED - the notification has been removed by the delivery machine
097 * AUTO_REMOVED - the notification was auto removed by the delivery machine
098 * @author Kuali Rice Team (rice.collab@kuali.org)
099 */
100 public static final class MESSAGE_DELIVERY_STATUS {
101 public static final String UNDELIVERED = "UNDELIVERED";
102 public static final String DELIVERED = "DELIVERED";
103 public static final String REMOVED = "REMOVED";
104 public static final String AUTO_REMOVED = "AUTO_REMOVED";
105 }
106
107 /**
108 * Different message delivery types for the notification system.
109 * KEW_ACTION_LIST_MESSAGE_DELIVERY_TYPE - the KEW action list
110 * DEFAULT_MESSAGE_DELIVERY_TYPE - the default message delivery type
111 * @author Kuali Rice Team (rice.collab@kuali.org)
112 */
113 public static final class MESSAGE_DELIVERY_TYPES {
114 public static final String KEW_ACTION_LIST_MESSAGE_DELIVERY_TYPE = "KEWActionList";
115 public static final String DEFAULT_MESSAGE_DELIVERY_TYPE = KEW_ACTION_LIST_MESSAGE_DELIVERY_TYPE;
116 }
117
118 /**
119 * Different recipient types for the notification system.
120 * USER - the notification specifically has a user as one of its recipients
121 * GROUP - the notification specifically has a group as one of its recipients
122 * @author Kuali Rice Team (rice.collab@kuali.org)
123 */
124 public static final class RECIPIENT_TYPES {
125 public static final String USER = "USER";
126 public static final String GROUP = "GROUP";
127 }
128
129 /**
130 * Different processing flags for the notification system.
131 * RESOLVED - the notification has been resolved by the system and specific message deliveries have been created
132 * UNRESOLVED - the notification has not been resolved by the system
133 * @author Kuali Rice Team (rice.collab@kuali.org)
134 */
135 public static final class PROCESSING_FLAGS {
136 public static final String RESOLVED = "RESOLVED";
137 public static final String UNRESOLVED = "UNRESOLVED";
138 }
139
140 /**
141 * Flags for record locking
142 * @author Kuali Rice Team (rice.collab@kuali.org)
143 */
144 public static final class LOCKED_FLAG {
145 public static final String UNLOCKED = "U";
146 public static final String LOCKED = "L";
147 }
148
149 /**
150 * Different response statuses for sending notifications.
151 * SUCCESS - the notification message was successfully received and will be processed and delivered by the system
152 * FAILURE - the notification message was received but there were problems and it will not be processed and delivered by the system.
153 * @author Kuali Rice Team (rice.collab@kuali.org)
154 */
155 public static final class RESPONSE_STATUSES {
156 public static final String SUCCESS = "Success";
157 public static final String FAILURE = "Failure";
158 }
159
160 /**
161 * Different response messages for sending notifications.
162 * @author Kuali Rice Team (rice.collab@kuali.org)
163 */
164 public static final class RESPONSE_MESSAGES {
165 public static final String SUCCESSFULLY_RECEIVED = "The notification message has been successfully received by the system and will be processed and delivered.";
166 public static final String PRODUCER_NOT_AUTHORIZED_FOR_CHANNEL = "The notification message was received by the system; however, " +
167 "we cannot process it because the Producer specified cannot send notifications for the Notification Channel specified.";
168 public static final String INVALID_RECIPIENT = "The notification message was received by the system; however, we cannot process it because one of " +
169 "the recipients that was specified was invalid and is not registered in the system.";
170 public static final String ERROR_SAVING_NOTIFICATION = "The notification message was received by the system; however, we cannot process it because " +
171 "there was a problem when trying to save the notification to the database.";
172 public static final String INVALID_DELIVERY_TYPE = "The notification message was received by the system; however, we cannot process it because " +
173 "the specified delivery type was invalid.";
174 public static final String INVALID_REMOVE_DATE = "The notification message was received by the system; however, we cannot process it because " +
175 "the specified auto-remove date is before the send date.";
176 }
177
178 /**
179 * This class houses constants that represent the property names for the business objects. This should
180 * be used for building database queries.
181 * @author Kuali Rice Team (rice.collab@kuali.org)
182 */
183 public static final class BO_PROPERTY_NAMES {
184 public static final String ID = "id";
185 public static final String NAME = "name";
186 public static final String DESCRIPTION = "description";
187 public static final String NAMESPACE = "namespace";
188 public static final String CHANNEL_ID = "channel.id";
189 public static final String RECIPIENT_TYPE = "recipientType";
190 public static final String RECIPIENT_ID = "recipientId";
191 public static final String REVIEWER_ID = "reviewerId";
192 public static final String RECIPIENTS_RECIPIENT_ID = "recipients.recipientId";
193 public static final String PROPERTY = "property";
194 public static final String VALUE = "value";
195 public static final String USER_ID = "userId";
196 public static final String CONTENT = "content";
197 public static final String PRODUCER_ID = "producerId";
198 public static final String CONTENT_TYPE_ID = "contentType.id";
199 public static final String CONTENT_TYPE_NAME = "contentType.name";
200 public static final String PROCESSING_FLAG = "processingFlag";
201 public static final String SEND_DATE_TIME = "sendDateTime";
202 public static final String NOTIFICATION_AUTO_REMOVE_DATE_TIME = "notification.autoRemoveDateTime";
203 public static final String MESSAGE_DELIVERY_STATUS = "messageDeliveryStatus";
204 public static final String LOCKED_DATE = "lockedDate";
205 // NotificationMessageDelivery
206 public static final String NOTIFICATION = "notification";
207 public static final String USER_RECIPIENT_ID = "userRecipientId";
208 public static final String DELIVERY_SYSTEM_ID = "deliverySystemId";
209 }
210
211 /**
212 * This inner class is used to hold constants needed for KEW integration.
213 * @author Kuali Rice Team (rice.collab@kuali.org)
214 */
215 public static final class KEW_CONSTANTS {
216 public static final String NOTIFICATION_DOC_TYPE = "KualiNotification";
217 public static final String NOTIFICATION_SYSTEM_USER = "notsys";
218 public static final String NOTIFICATION_SYSTEM_USER_NAME = "Notification System";
219 public static final String NOTIFICATION_SYSTEM_USER_PARAM = "ken.system.user";
220 public static final String FYI_AD_HOC_ROUTE = KEWConstants.ACTION_REQUEST_FYI_REQ;
221 public static final String ACK_AD_HOC_ROUTE = KEWConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ;
222 public static final String GENERIC_DELIVERY_ANNOTATION = "The notification message has been delivered by the Notification System.";
223 public static final String GENERIC_AUTO_REMOVE_ANNOTATION = "The notification message has been auto-removed by the Notification System.";
224 public static final String NOTIFICATION_ADMIN_GROUP_NAME = "NotificationAdmin";
225 public static final String SEND_NOTIFICATION_REQ_DOC_TYPE = "SendNotificationRequest";
226 }
227
228 /**
229 * This inner class is used to hold constants around needed for the default system producer which all channels must be exposed
230 * to for the generic message sending form to work with.
231 * @author Kuali Rice Team (rice.collab@kuali.org)
232 */
233 public static final class NOTIFICATION_PRODUCERS {
234 public static final NotificationProducer NOTIFICATION_SYSTEM_PRODUCER = buildNotificationSystemProducer();
235
236 public static final String NOTIFICATION_SYSTEM_PRODUCER_NAME = "Notification System";
237 public static final String NOTIFICATION_SYSTEM_PRODUCER_DESCRIPTION = "This producer represents messages sent from the general message sending form.";
238 public static final String NOTIFICATION_SYSTEM_PRODUCER_CONTACT_INFO = "admins-notsys@cornell.edu";
239
240 /**
241 * This method is a helper to build the static NotificationProducer Notification System Producer instance, which is the
242 * default producer that all channels automatically have added to them when they are created.
243 * @return NotificationProducer
244 */
245 private static final NotificationProducer buildNotificationSystemProducer() {
246 NotificationProducer producer = new NotificationProducer();
247 producer.setName(NOTIFICATION_SYSTEM_PRODUCER_NAME);
248 producer.setDescription(NOTIFICATION_SYSTEM_PRODUCER_DESCRIPTION);
249 producer.setContactInfo(NOTIFICATION_SYSTEM_PRODUCER_CONTACT_INFO);
250 return producer;
251 }
252 }
253 }