1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ken.service.impl;
17
18 import java.util.ArrayList;
19 import java.util.Collection;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
23 import org.kuali.rice.ken.bo.NotificationChannel;
24 import org.kuali.rice.ken.api.service.KENAPIService;
25 import org.kuali.rice.ken.service.NotificationChannelService;
26 import org.kuali.rice.ken.service.UserPreferenceService;
27 import org.springframework.beans.factory.annotation.Required;
28
29
30
31
32
33
34 public class KENAPIServiceImpl implements KENAPIService {
35 private NotificationChannelService channelService;
36 private UserPreferenceService prefsService;
37
38
39
40
41
42 @Required
43 public void setNotificationChannelService(NotificationChannelService ncs) {
44 this.channelService = ncs;
45 }
46
47
48
49
50
51 @Required
52 public void setUserPreferenceService(UserPreferenceService ups) {
53 this.prefsService = ups;
54 }
55
56
57
58
59 public Collection<String> getAllChannelNames() {
60 Collection<NotificationChannel> chans = channelService.getAllNotificationChannels();
61 Collection<String> chanNames = new ArrayList<String>(chans.size());
62 for (NotificationChannel c: chans) {
63 chanNames.add(c.getName());
64 }
65 return chanNames;
66 }
67
68
69
70
71 public Collection<String> getDeliverersForRecipientAndChannel(String recipient, String channel) {
72 if (StringUtils.isBlank(recipient)) {
73 throw new RiceIllegalArgumentException("recipient is null or blank");
74 }
75
76 if (StringUtils.isBlank(channel)) {
77 throw new RiceIllegalArgumentException("channel is null or blank");
78 }
79
80
81
82
83
84
85
86
87
88
89
90 return null;
91 }
92
93
94
95
96 public String getRecipientPreference(String recipient, String prefKey) {
97 if (StringUtils.isBlank(recipient)) {
98 throw new RiceIllegalArgumentException("recipient is null or blank");
99 }
100
101 if (StringUtils.isBlank(prefKey)) {
102 throw new RiceIllegalArgumentException("prefKey is null or blank");
103 }
104
105
106
107
108
109 return null;
110 }
111 }