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;
019import java.util.HashMap;
020
021import org.kuali.rice.kcb.bo.RecipientDelivererConfig;
022import org.kuali.rice.kcb.bo.RecipientPreference;
023import org.kuali.rice.kcb.deliverer.MessageDeliverer;
024import org.kuali.rice.kcb.exception.ErrorList;
025
026/**
027 * Service for accessing user preferences in the KEN system.{@link UserPreference}
028 * @author Kuali Rice Team (rice.collab@kuali.org)
029 */
030public interface RecipientPreferenceService {
031    /**
032     * This method will get all  user recipient preferences from the system.
033     * @param recipientId
034     */
035    public HashMap<String, String> getRecipientPreferences(String recipientId);
036
037    /**
038     * This method will save a user recipient preferences in the system.
039     * @param userid
040     * @param prefs a hashmap of key/values
041     * @param deliveryTypeName name of deliverer
042     */
043    public void saveRecipientPreferences(String userid, HashMap<String, String> prefs, MessageDeliverer deliverer) throws ErrorList;
044    
045    /**
046     * This method will get a specific user recipient preferences from the system.
047     * @param recipientId
048     * @param key
049     */
050    public RecipientPreference getRecipientPreference(String recipientId, String key);
051
052    /**
053     * This method will save a specific user recipient preferences in the system.
054     * @param pref the preferences
055     */
056    public void saveRecipientPreference(RecipientPreference pref);
057    
058    /**
059     * This method will delete a specific user recipient preferences from the system.
060     * @param pref the preferences
061     */
062    public void deleteRecipientPreference(RecipientPreference pref);
063
064    // deliverer configuration
065    
066    /**
067     * This method will remove all user deliverer configuration preferences in the system.
068     * @param recipientId the recipient id
069     */
070    public void removeRecipientDelivererConfigs(String recipientId);
071    
072    /**
073     * This method will save a user deliverer configuration preferences in the system.
074     * @param recipientId the recipient id
075     * @param delivererName the deliverer name
076     * @param channels the channels for which to enable the deliverer
077     */
078    public void saveRecipientDelivererConfig(String recipientId, String delivererName, String[] channels);
079
080    /**
081     * This method will retrieve all of the message deliverer configurations for a given user, associated with a 
082     * particular channel.
083     * @param recipientId
084     * @param channel
085     */
086    public Collection<RecipientDelivererConfig> getDeliverersForRecipientAndChannel(String recipientId, String channel);
087    
088    /**
089     * This method will retrieve all of the message deliverer configurations for a given user 
090     * @param recipientId
091     */
092    public Collection<RecipientDelivererConfig> getDeliverersForRecipient(String recipientId);
093}