View Javadoc
1   /**
2    * Copyright 2005-2016 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.service;
17  
18  import java.util.Collection;
19  
20  import org.kuali.rice.ken.bo.NotificationBo;
21  import org.kuali.rice.ken.bo.NotificationMessageDelivery;
22  
23  /**
24   * The NotificationMessageDeliveryService class is responsible various functions regarding the 
25   * NotificationMessageDelivery records that exist within the system.
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public interface NotificationMessageDeliveryService {
29      /**
30       * This method will retrieve a NotificationMessageDelivery object from the system, given the id of the 
31       * actual record.
32       * @param id
33       * @return NotificationMessageDelivery
34       */
35      public NotificationMessageDelivery getNotificationMessageDelivery(Long id);
36  
37      /**
38       * This method will retrieve a NotificationMessageDelivery object from the system, given the external deliverer system id
39       * registered with the NotificationMessageDelivery.
40       * @param id the external deliverer system id
41       * @return NotificationMessageDelivery
42       */
43      public NotificationMessageDelivery getNotificationMessageDeliveryByDelivererId(String id);
44  
45      /**
46       * This method will return all NotificationMessageDelivery objects in the system 
47       * actual record.
48       * @return List<NotificationMessageDelivery> list of NotificationMessageDelivery objects in the system
49       */
50      public Collection<NotificationMessageDelivery> getNotificationMessageDeliveries();
51      
52      /**
53       * This method will return all NotificationMessageDelievery objects generated for the given Notification for the given user
54       * @param notification the notification which generated the message deliveries
55       * @param userRecipientId the id of the user whose message deliveries to obtain
56       * @return collection of NotificationMessageDelivery objects generated for the given Notification for the given user
57       */
58      public Collection<NotificationMessageDelivery> getNotificationMessageDeliveries(NotificationBo notification, String userRecipientId);
59      
60      /**
61       * This method is responsible for atomically finding all untaken, undelivered message deliveries, marking them as taken
62       * and returning them to the caller for processing.
63       * NOTE: it is important that this method execute in a SEPARATE dedicated transaction; either the caller should
64       * NOT be wrapped by Spring declarative transaction and this service should be wrapped (which is the case), or
65       * the caller should arrange to invoke this from within a newly created transaction).
66       * @return a list of available message deliveries that have been marked as taken by the caller
67       */
68      public Collection<NotificationMessageDelivery> takeMessageDeliveriesForDispatch();
69      
70      /**
71       * This method is responsible for atomically finding all untaken message deliveries that are ready to be autoremoved,
72       * marking them as taken and returning them to the caller for processing.
73       * NOTE: it is important that this method execute in a SEPARATE dedicated transaction; either the caller should
74       * NOT be wrapped by Spring declarative transaction and this service should be wrapped (which is the case), or
75       * the caller should arrange to invoke this from within a newly created transaction).
76       * @return a list of notifications to be autoremoved that have been marked as taken by the caller
77       */
78      public Collection<NotificationMessageDelivery> takeMessageDeliveriesForAutoRemoval();
79      
80      /**
81       * Unlocks the specified messageDelivery object
82       * @param messageDelivery the message delivery to unlock
83       */
84      public void unlockMessageDelivery(NotificationMessageDelivery messageDelivery);
85  }