View Javadoc

1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.ken.util;
17  
18  import org.kuali.rice.ken.bo.NotificationProducerBo;
19  import org.kuali.rice.kew.api.KewApiConstants;
20  
21  /**
22   * This class houses all constants for the NotificationSystem.
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public final class NotificationConstants {
26  
27      /**
28       * This inner class holds contants that are used for parsing and resolving of content 
29       * inside of the XML message format that represents a notification request.
30       * @author Kuali Rice Team (rice.collab@kuali.org)
31       */
32      public static final class XML_MESSAGE_CONSTANTS {
33          public static final String MESSAGE_OPEN = "<message><![CDATA[";
34          public static final String MESSAGE_CLOSE = "]]></message>";
35          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\">";
36          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\">";
37          public static final String CONTENT_CLOSE = "</content>";
38  
39          private XML_MESSAGE_CONSTANTS() {
40              throw new UnsupportedOperationException("do not call");
41          }
42      }
43  
44      /**
45       * Different content types for the Notification System.  These are static out of the box content types that have specific UIs built for them.
46   * @author Kuali Rice Team (rice.collab@kuali.org)
47       */
48      public static final class CONTENT_TYPES {
49          public static final String EVENT_CONTENT_TYPE = "Event";
50          public static final String SIMPLE_CONTENT_TYPE = "Simple";
51  
52          private CONTENT_TYPES() {
53              throw new UnsupportedOperationException("do not call");
54          }
55      }
56  
57      /**
58       * Different delivery types for the Notification System.
59       * FYI - user gets notification in list, but can remove without actually viewing details and taking action
60       * ACK - user gets notification in list, but has to view details and conciously press the acknowledge button
61   * @author Kuali Rice Team (rice.collab@kuali.org)
62       */
63      public static final class DELIVERY_TYPES {
64          public static final String FYI = "FYI";
65          public static final String ACK = "ACK";
66  
67          private DELIVERY_TYPES() {
68              throw new UnsupportedOperationException("do not call");
69          }
70      }
71  
72      /**
73       * String that indicates the cause of a dismissal of a messageDelivery was
74       * due to autoremoval
75       */
76      public static final String AUTO_REMOVE_CAUSE = "autoremove";
77      public static final String ACK_CAUSE = "ack";
78      public static final String FYI_CAUSE = "fyi";
79  
80      /**
81       * This class holds constants for different detail views of a notification.
82       * INLINE - display the details inline (i.e. without any menus around them)
83       * NORMAL_VIEW - display the details in a normal view with all of the appropriate menus
84   * @author Kuali Rice Team (rice.collab@kuali.org)
85       */
86      public static final class NOTIFICATION_DETAIL_VIEWS {
87          public static final String NORMAL_VIEW = "displayActionListView";
88          public static final String INLINE = "displayActionListInlineView";
89          public static final String DOC_SEARCH_VIEW = "displayDocSearchView";
90  
91          private NOTIFICATION_DETAIL_VIEWS() {
92              throw new UnsupportedOperationException("do not call");
93          }
94      }
95  
96      /**
97       * Constants for request processing (web layer).
98   * @author Kuali Rice Team (rice.collab@kuali.org)
99       */
100     public static final class NOTIFICATION_CONTROLLER_CONSTANTS {
101         public static final String MSG_DELIVERY_ID = "messageDeliveryId";
102         public static final String DELIVERER_ID = "delivererId";
103         public static final String DOC_ID = "docId";
104         public static final String COMMAND = "command";
105         public static final String STANDALONE_WINDOW = "standaloneWindow";
106 
107         private NOTIFICATION_CONTROLLER_CONSTANTS() {
108             throw new UnsupportedOperationException("do not call");
109         }
110     }
111 
112     /**
113      * Different delivery status flags for the notification system.
114      * UNDELIVERED - the notification has not been delivered by the delivery machine
115      * DELIVERED - the notification has been delivered by the delivery machine
116      * REMOVED - the notification has been removed by the delivery machine
117      * AUTO_REMOVED - the notification was auto removed by the delivery machine
118  * @author Kuali Rice Team (rice.collab@kuali.org)
119      */
120     public static final class MESSAGE_DELIVERY_STATUS {
121         public static final String UNDELIVERED = "UNDELIVERED";
122         public static final String DELIVERED = "DELIVERED";
123         public static final String REMOVED = "REMOVED";
124         public static final String AUTO_REMOVED = "AUTO_REMOVED";
125 
126         private MESSAGE_DELIVERY_STATUS() {
127             throw new UnsupportedOperationException("do not call");
128         }
129     }
130 
131     /**
132      * Different message delivery types for the notification system.
133      * KEW_ACTION_LIST_MESSAGE_DELIVERY_TYPE - the KEW action list
134      * DEFAULT_MESSAGE_DELIVERY_TYPE - the default message delivery type
135  * @author Kuali Rice Team (rice.collab@kuali.org)
136      */
137     public static final class MESSAGE_DELIVERY_TYPES {
138         public static final String KEW_ACTION_LIST_MESSAGE_DELIVERY_TYPE = "KEWActionList"; 
139         public static final String DEFAULT_MESSAGE_DELIVERY_TYPE = KEW_ACTION_LIST_MESSAGE_DELIVERY_TYPE;
140 
141         private MESSAGE_DELIVERY_TYPES() {
142             throw new UnsupportedOperationException("do not call");
143         }
144     }
145 
146     /**
147      * Different recipient types for the notification system.
148      * USER - the notification specifically has a user as one of its recipients
149      * GROUP - the notification specifically has a group as one of its recipients
150  * @author Kuali Rice Team (rice.collab@kuali.org)
151      */
152     public static final class RECIPIENT_TYPES {
153         public static final String USER = "USER";
154         public static final String GROUP = "GROUP";
155 
156         private RECIPIENT_TYPES() {
157             throw new UnsupportedOperationException("do not call");
158         }
159     }
160 
161     /**
162      * Different processing flags for the notification system.
163      * RESOLVED - the notification has been resolved by the system and specific message deliveries have been created
164      * UNRESOLVED - the notification has not been resolved by the system
165  * @author Kuali Rice Team (rice.collab@kuali.org)
166      */
167     public static final class PROCESSING_FLAGS {
168         public static final String RESOLVED = "RESOLVED";
169         public static final String UNRESOLVED = "UNRESOLVED";
170 
171         private PROCESSING_FLAGS() {
172             throw new UnsupportedOperationException("do not call");
173         }
174     }
175 
176     /**
177      * Flags for record locking
178  * @author Kuali Rice Team (rice.collab@kuali.org)
179      */
180     public static final class LOCKED_FLAG {
181         public static final String UNLOCKED = "U";
182         public static final String LOCKED = "L";
183 
184         private LOCKED_FLAG() {
185             throw new UnsupportedOperationException("do not call");
186         }
187     }
188 
189     /**
190      * Different response statuses for sending notifications.
191      * SUCCESS - the notification message was successfully received and will be processed and delivered by the system
192      * FAILURE - the notification message was received but there were problems and it will not be processed and delivered by the system.
193  * @author Kuali Rice Team (rice.collab@kuali.org)
194      */
195     public static final class RESPONSE_STATUSES {
196         public static final String SUCCESS = "Success";
197         public static final String FAILURE = "Failure";
198 
199         private RESPONSE_STATUSES() {
200             throw new UnsupportedOperationException("do not call");
201         }
202     }
203 
204     /**
205      * Different response messages for sending notifications.
206  * @author Kuali Rice Team (rice.collab@kuali.org)
207      */
208     public static final class RESPONSE_MESSAGES {
209         public static final String SUCCESSFULLY_RECEIVED = "The notification message has been successfully received by the system and will be processed and delivered.";
210         public static final String PRODUCER_NOT_AUTHORIZED_FOR_CHANNEL = "The notification message was received by the system; however, " +
211             "we cannot process it because the Producer specified cannot send notifications for the Notification Channel specified.";
212         public static final String INVALID_RECIPIENT = "The notification message was received by the system; however, we cannot process it because one of " +
213             "the recipients that was specified was invalid and is not registered in the system.";
214         public static final String ERROR_SAVING_NOTIFICATION = "The notification message was received by the system; however, we cannot process it because " +
215             "there was a problem when trying to save the notification to the database.";
216         public static final String INVALID_DELIVERY_TYPE = "The notification message was received by the system; however, we cannot process it because " +
217             "the specified delivery type was invalid.";
218         public static final String INVALID_REMOVE_DATE = "The notification message was received by the system; however, we cannot process it because " +
219     "the specified auto-remove date is before the send date.";
220 
221         private RESPONSE_MESSAGES() {
222             throw new UnsupportedOperationException("do not call");
223         }
224     }
225 
226     /**
227      * This class houses constants that represent the property names for the business objects.  This should 
228      * be used for building database queries.
229  * @author Kuali Rice Team (rice.collab@kuali.org)
230      */
231     public static final class BO_PROPERTY_NAMES {
232         public static final String ID = "id";
233         public static final String NAME = "name";
234         public static final String DESCRIPTION = "description";
235         public static final String NAMESPACE = "namespace";
236         public static final String CHANNEL_ID = "channel.id";
237         public static final String RECIPIENT_TYPE = "recipientType";
238         public static final String RECIPIENT_ID = "recipientId";
239         public static final String REVIEWER_ID = "reviewerId";
240         public static final String RECIPIENTS_RECIPIENT_ID = "recipients.recipientId";
241         public static final String PROPERTY = "property";
242         public static final String VALUE = "value";
243         public static final String USER_ID = "userId";
244         public static final String CONTENT = "content";
245         public static final String PRODUCER_ID = "producerId";
246         public static final String CONTENT_TYPE_ID = "contentType.id";
247         public static final String CONTENT_TYPE_NAME = "contentType.name";
248         public static final String PROCESSING_FLAG = "processingFlag";
249         public static final String SEND_DATE_TIME = "sendDateTimeValue";
250         public static final String NOTIFICATION_AUTO_REMOVE_DATE_TIME = "notification.autoRemoveDateTimeValue";
251         public static final String MESSAGE_DELIVERY_STATUS = "messageDeliveryStatus";
252         public static final String LOCKED_DATE = "lockedDateValue";
253         // NotificationMessageDelivery
254         public static final String NOTIFICATION = "notification";
255         public static final String USER_RECIPIENT_ID = "userRecipientId";
256         public static final String DELIVERY_SYSTEM_ID = "deliverySystemId";
257 
258         private BO_PROPERTY_NAMES() {
259             throw new UnsupportedOperationException("do not call");
260         }
261     }
262 
263     /**
264      * This inner class is used to hold constants needed for KEW integration.
265  * @author Kuali Rice Team (rice.collab@kuali.org)
266      */
267     public static final class KEW_CONSTANTS {
268         public static final String NOTIFICATION_DOC_TYPE = "KualiNotification";
269         public static final String NOTIFICATION_SYSTEM_USER = "notsys";
270         public static final String NOTIFICATION_SYSTEM_USER_NAME = "Notification System";
271         public static final String NOTIFICATION_SYSTEM_USER_PARAM = "ken.system.user";
272         public static final String FYI_AD_HOC_ROUTE = KewApiConstants.ACTION_REQUEST_FYI_REQ;
273         public static final String ACK_AD_HOC_ROUTE = KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ;
274         public static final String GENERIC_DELIVERY_ANNOTATION = "The notification message has been delivered by the Notification System.";
275         public static final String GENERIC_AUTO_REMOVE_ANNOTATION = "The notification message has been auto-removed by the Notification System.";
276         public static final String NOTIFICATION_ADMIN_GROUP_NAME = "NotificationAdmin";
277         public static final String SEND_NOTIFICATION_REQ_DOC_TYPE = "SendNotificationRequest";
278 
279         private KEW_CONSTANTS() {
280             throw new UnsupportedOperationException("do not call");
281         }
282     }
283 
284     /**
285      * This inner class is used to hold constants around needed for the default system producer which all channels must be exposed 
286      * to for the generic message sending form to work with.
287  * @author Kuali Rice Team (rice.collab@kuali.org)
288      */
289     public static final class NOTIFICATION_PRODUCERS {
290         public static final NotificationProducerBo NOTIFICATION_SYSTEM_PRODUCER = buildNotificationSystemProducer();
291 
292         public static final String NOTIFICATION_SYSTEM_PRODUCER_NAME = "Notification System";
293         public static final String NOTIFICATION_SYSTEM_PRODUCER_DESCRIPTION = "This producer represents messages sent from the general message sending form.";
294         public static final String NOTIFICATION_SYSTEM_PRODUCER_CONTACT_INFO = "admins-notsys@cornell.edu";
295 
296         /**
297          * This method is a helper to build the static NotificationProducer Notification System Producer instance, which is the 
298          * default producer that all channels automatically have added to them when they are created.
299          * @return NotificationProducer
300          */
301         private static final NotificationProducerBo buildNotificationSystemProducer() {
302             NotificationProducerBo producer = new NotificationProducerBo();
303             producer.setName(NOTIFICATION_SYSTEM_PRODUCER_NAME);
304             producer.setDescription(NOTIFICATION_SYSTEM_PRODUCER_DESCRIPTION);
305             producer.setContactInfo(NOTIFICATION_SYSTEM_PRODUCER_CONTACT_INFO);
306             return producer;
307         }
308 
309         private NOTIFICATION_PRODUCERS() {
310             throw new UnsupportedOperationException("do not call");
311         }
312     }
313 }