| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| KENAPIServiceImpl |
|
| 1.2;1.2 |
| 1 | /* | |
| 2 | * Copyright 2007-2008 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.impl; | |
| 17 | ||
| 18 | import java.util.ArrayList; | |
| 19 | import java.util.Collection; | |
| 20 | ||
| 21 | import org.kuali.rice.ken.bo.NotificationChannel; | |
| 22 | import org.kuali.rice.ken.service.KENAPIService; | |
| 23 | import org.kuali.rice.ken.service.NotificationChannelService; | |
| 24 | import org.kuali.rice.ken.service.UserPreferenceService; | |
| 25 | import org.springframework.beans.factory.annotation.Required; | |
| 26 | ||
| 27 | /** | |
| 28 | * KEN API service implementation | |
| 29 | * | |
| 30 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 31 | */ | |
| 32 | 0 | public class KENAPIServiceImpl implements KENAPIService { |
| 33 | private NotificationChannelService channelService; | |
| 34 | private UserPreferenceService prefsService; | |
| 35 | ||
| 36 | /** | |
| 37 | * Sets the NotificationChannelService | |
| 38 | * @param ncs the NotificationChannelService | |
| 39 | */ | |
| 40 | @Required | |
| 41 | public void setNotificationChannelService(NotificationChannelService ncs) { | |
| 42 | 0 | this.channelService = ncs; |
| 43 | 0 | } |
| 44 | ||
| 45 | /** | |
| 46 | * Sets the UserPreferenceService | |
| 47 | * @param ups the UserPreferenceService | |
| 48 | */ | |
| 49 | @Required | |
| 50 | public void setUserPreferenceService(UserPreferenceService ups) { | |
| 51 | 0 | this.prefsService = ups; |
| 52 | 0 | } |
| 53 | ||
| 54 | /** | |
| 55 | * @see org.kuali.rice.ken.service.KENAPIService#getAllChannels() | |
| 56 | */ | |
| 57 | public Collection<String> getAllChannelNames() { | |
| 58 | 0 | Collection<NotificationChannel> chans = channelService.getAllNotificationChannels(); |
| 59 | 0 | Collection<String> chanNames = new ArrayList<String>(chans.size()); |
| 60 | 0 | for (NotificationChannel c: chans) { |
| 61 | 0 | chanNames.add(c.getName()); |
| 62 | } | |
| 63 | 0 | return chanNames; |
| 64 | } | |
| 65 | ||
| 66 | /** | |
| 67 | * @see org.kuali.rice.ken.service.KENAPIService#getDeliverersForRecipientAndChannel(java.lang.String, java.lang.String) | |
| 68 | */ | |
| 69 | public Collection<String> getDeliverersForRecipientAndChannel(String recipient, String channel) { | |
| 70 | /*NotificationChannel nc = channelService.getNotificationChannelByName(channel); | |
| 71 | if (nc == null) { | |
| 72 | throw new RuntimeException("Invalid channel: '" + channel + "'"); | |
| 73 | } | |
| 74 | Collection<UserDelivererConfig> configs = prefsService.getMessageDelivererConfigurationsForUserAndChannel(recipient, nc); | |
| 75 | Collection<String> deliverers = new ArrayList<String>(configs.size()); | |
| 76 | for (UserDelivererConfig cfg: configs) { | |
| 77 | deliverers.add(cfg.getDelivererName()); | |
| 78 | } | |
| 79 | return deliverers;*/ | |
| 80 | 0 | return null; |
| 81 | } | |
| 82 | ||
| 83 | /** | |
| 84 | * @see org.kuali.rice.ken.service.KENAPIService#getRecipientPreference(java.lang.String, java.lang.String) | |
| 85 | */ | |
| 86 | public String getRecipientPreference(String recipient, String prefKey) { | |
| 87 | /*RecipientPreference rp = prefsService.getUserRecipientPreferences(recipient, prefKey); | |
| 88 | if (rp == null) return null; | |
| 89 | return rp.getValue(); | |
| 90 | */ | |
| 91 | 0 | return null; |
| 92 | } | |
| 93 | } |