Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AOLInstantMessageDeliverer |
|
| 1.5;1.5 |
1 | /** | |
2 | * Copyright 2005-2011 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.kcb.deliverer.impl; | |
17 | ||
18 | import java.util.HashMap; | |
19 | import java.util.LinkedHashMap; | |
20 | ||
21 | import org.apache.commons.lang.StringUtils; | |
22 | import org.apache.log4j.Logger; | |
23 | import org.kuali.rice.kcb.bo.MessageDelivery; | |
24 | import org.kuali.rice.kcb.deliverer.MessageDeliverer; | |
25 | import org.kuali.rice.kcb.exception.ErrorList; | |
26 | import org.kuali.rice.kcb.api.exception.MessageDeliveryException; | |
27 | import org.kuali.rice.kcb.api.exception.MessageDismissalException; | |
28 | ||
29 | /** | |
30 | * This class is responsible for describing the AOL Instant Messenger delivery mechanism for | |
31 | * the system; however, it is not yet integrated into the system and is just a stub. | |
32 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
33 | */ | |
34 | public class AOLInstantMessageDeliverer implements MessageDeliverer { | |
35 | 0 | private static Logger LOG = Logger.getLogger(AOLInstantMessageDeliverer.class); |
36 | ||
37 | private static final String SCREEN_NAME = "aim_screen_name"; | |
38 | ||
39 | /** | |
40 | * Constructs a AOLInstantMessageDeliverer.java. | |
41 | */ | |
42 | 0 | public AOLInstantMessageDeliverer() { |
43 | 0 | } |
44 | ||
45 | /** | |
46 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#deliver(org.kuali.rice.kcb.bo.MessageDelivery) | |
47 | */ | |
48 | public void deliver(MessageDelivery messageDelivery) throws MessageDeliveryException { | |
49 | 0 | } |
50 | ||
51 | /** | |
52 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#dismiss(org.kuali.rice.kcb.bo.MessageDelivery, java.lang.String, java.lang.String) | |
53 | */ | |
54 | public void dismiss(MessageDelivery messageDelivery, String user, String cause) throws MessageDismissalException { | |
55 | 0 | } |
56 | ||
57 | /** | |
58 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#getDescription() | |
59 | */ | |
60 | public String getDescription() { | |
61 | 0 | return "This is the default AOL Instant Messenger delivery type."; |
62 | } | |
63 | ||
64 | /** | |
65 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#getName() | |
66 | */ | |
67 | public String getName() { | |
68 | 0 | return "AIM"; |
69 | } | |
70 | ||
71 | /** | |
72 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#getTitle() | |
73 | */ | |
74 | public String getTitle() { | |
75 | 0 | return "AOL Instant Messenger Delivery"; |
76 | } | |
77 | ||
78 | /** | |
79 | * This implementation returns a screen name field. | |
80 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#getPreferenceKeys() | |
81 | */ | |
82 | public LinkedHashMap getPreferenceKeys() { | |
83 | 0 | LinkedHashMap<String, String> prefKeys = new LinkedHashMap<String, String>(); |
84 | 0 | prefKeys.put(SCREEN_NAME, "AIM Screen Name"); |
85 | 0 | return prefKeys; |
86 | } | |
87 | ||
88 | /** | |
89 | * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#validatePreferenceValues(java.util.HashMap) | |
90 | */ | |
91 | public void validatePreferenceValues(HashMap prefs) throws ErrorList { | |
92 | 0 | boolean error = false; |
93 | 0 | ErrorList errorList = new ErrorList(); |
94 | ||
95 | 0 | if (!prefs.containsKey(getName()+"."+SCREEN_NAME)) { |
96 | 0 | errorList.addError("AIM Screen Name is a required field."); |
97 | 0 | error = true; |
98 | } else { | |
99 | 0 | String screenName = (String) prefs.get(getName()+"."+SCREEN_NAME); |
100 | 0 | if(StringUtils.isBlank(screenName)) { |
101 | 0 | errorList.addError("AIM Screen Name is a required."); |
102 | 0 | error = true; |
103 | } | |
104 | } | |
105 | 0 | if (error) throw errorList; |
106 | 0 | } |
107 | } |