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 @Override
60 public Collection<String> getAllChannelNames() {
61 Collection<NotificationChannel> chans = channelService.getAllNotificationChannels();
62 Collection<String> chanNames = new ArrayList<String>(chans.size());
63 for (NotificationChannel c: chans) {
64 chanNames.add(c.getName());
65 }
66 return chanNames;
67 }
68
69
70
71
72 @Override
73 public Collection<String> getDeliverersForRecipientAndChannel(String recipient, String channel) {
74 if (StringUtils.isBlank(recipient)) {
75 throw new RiceIllegalArgumentException("recipient is null or blank");
76 }
77
78 if (StringUtils.isBlank(channel)) {
79 throw new RiceIllegalArgumentException("channel is null or blank");
80 }
81
82
83
84
85
86
87
88
89
90
91
92 return null;
93 }
94
95
96
97
98 @Override
99 public String getRecipientPreference(String recipient, String prefKey) {
100 if (StringUtils.isBlank(recipient)) {
101 throw new RiceIllegalArgumentException("recipient is null or blank");
102 }
103
104 if (StringUtils.isBlank(prefKey)) {
105 throw new RiceIllegalArgumentException("prefKey is null or blank");
106 }
107
108
109
110
111
112 return null;
113 }
114 }