001/**
002 * Copyright 2005-2016 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 */
016package org.kuali.rice.kcb.service;
017
018import java.util.Collection;
019
020import org.kuali.rice.kcb.bo.Message;
021import org.kuali.rice.kcb.bo.MessageDelivery;
022import org.kuali.rice.kcb.bo.MessageDeliveryStatus;
023
024/**
025 * The MessageDeliveryService class is responsible various functions regarding the 
026 * MessageDelivery records that exist within the system.
027 *
028 * @author Kuali Rice Team (rice.collab@kuali.org)
029 */
030public interface MessageDeliveryService {
031    /**
032     * Saves a MessageDelivery
033     * @param delivery the MessageDelivery to save
034     */
035    public MessageDelivery saveMessageDelivery(MessageDelivery delivery);
036
037    /**
038     * Deletes a MessageDelivery
039     * @param delivery the MessageDelivery to delete 
040     */
041    public void deleteMessageDelivery(MessageDelivery delivery);
042
043    /**
044     * This method will retrieve a MessageDelivery object from the system, given the id of the 
045     * actual record.
046     * @param id
047     * @return MessageDelivery
048     */
049    public MessageDelivery getMessageDelivery(Long id);
050
051    /**
052     * This method will retrieve a MessageDelivery object from the system, given the external deliverer system id
053     * registered with the MessageDelivery.
054     * @param id the external deliverer system id
055     * @return MessageDelivery
056     */
057    public MessageDelivery getMessageDeliveryByDelivererSystemId(Long id);
058
059    /**
060     * This method will return all MessageDelivery objects in the system 
061     * @return Collection<MessageDelivery> list of MessageDelivery objects in the system
062     */
063    public Collection<MessageDelivery> getAllMessageDeliveries();
064    
065    /**
066     * This method will return all MessageDelievery objects generated for the given Message
067     * @param message the message which generated the message deliveries
068     * @return collection of NotificationMessageDelivery objects generated for the given Notification for the given user
069     */
070    public Collection<MessageDelivery> getMessageDeliveries(Message message);
071    
072    /**
073     * Locks and takes all message deliveries of a given message in the system with any of the specified statuses
074     * @param messageId the id of the message whose deliveries to take 
075     * @param status the statuses of message deliveries to take
076     * @return a collection of message deliveries
077     */
078    public Collection<MessageDelivery> lockAndTakeMessageDeliveries(Long messageId, MessageDeliveryStatus[] status);
079
080    /**
081     * Locks and takes all message deliveries in the system with any of the specified statuses
082     * @param status the statuses of message deliveries to take
083     * @return a collection of message deliveries
084     */
085    public Collection<MessageDelivery> lockAndTakeMessageDeliveries(MessageDeliveryStatus[] status);
086}