Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SmsTextEmailNotifier |
|
| 1.0;1 |
1 | /* | |
2 | * This software is licensed under the Apache License, Version 2.0 | |
3 | * (the "License") agreement; you may not use this file except in compliance with | |
4 | * the License. You may obtain a copy of the License at | |
5 | * | |
6 | * http://www.apache.org/licenses/LICENSE-2.0 | |
7 | * | |
8 | * Unless required by applicable law or agreed to in writing, software | |
9 | * distributed under the License is distributed on an "AS IS" BASIS, | |
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
11 | * See the License for the specific language governing permissions and | |
12 | * limitations under the License. | |
13 | */ | |
14 | package net.admin4j.util.notify; | |
15 | ||
16 | import net.admin4j.deps.commons.lang3.StringUtils; | |
17 | ||
18 | ||
19 | /** | |
20 | * Used to support SMS messages via a Email interface. Message will be restricted to 70 bytes. | |
21 | * <p>Note: If the logger for this class is DEBUG, the debug setting will | |
22 | * be passed onto the java mail api.</p> | |
23 | * @author D. Ashmore | |
24 | * | |
25 | */ | |
26 | 3 | public class SmsTextEmailNotifier extends TextEmailNotifier { |
27 | ||
28 | private static final int MAX_SMS_MESSAGE_LENGTH = 70; | |
29 | ||
30 | /* (non-Javadoc) | |
31 | * @see net.admin4j.util.notify.TextEmailNotifier#notify(java.lang.String, java.lang.String) | |
32 | */ | |
33 | @Override | |
34 | public void notify(String subject, String message) { | |
35 | super.notify(subject, StringUtils.abbreviate(message, MAX_SMS_MESSAGE_LENGTH)); | |
36 | 0 | } |
37 | ||
38 | /* (non-Javadoc) | |
39 | * @see net.admin4j.util.notify.BaseEmailNotifier#supportsSMS() | |
40 | */ | |
41 | @Override | |
42 | public boolean supportsSMS() { | |
43 | 3 | return true; |
44 | } | |
45 | ||
46 | } |