| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package com.xpn.xwiki.plugin.mailsender; |
| 21 |
|
|
| 22 |
|
import java.util.List; |
| 23 |
|
import java.util.Map; |
| 24 |
|
import java.util.TreeMap; |
| 25 |
|
|
| 26 |
|
import com.xpn.xwiki.api.Attachment; |
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| |
|
| 80.8% |
Uncovered Elements: 19 (99) |
Complexity: 32 |
Complexity Density: 0.54 |
|
| 31 |
|
public class Mail |
| 32 |
|
{ |
| 33 |
|
private String from; |
| 34 |
|
|
| 35 |
|
private String to; |
| 36 |
|
|
| 37 |
|
private String cc; |
| 38 |
|
|
| 39 |
|
private String bcc; |
| 40 |
|
|
| 41 |
|
private String subject; |
| 42 |
|
|
| 43 |
|
private String textPart; |
| 44 |
|
|
| 45 |
|
private String htmlPart; |
| 46 |
|
|
| 47 |
|
private List<Attachment> attachments; |
| 48 |
|
|
| 49 |
|
private Map<String, String> headers; |
| 50 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 51 |
15 |
public Mail()... |
| 52 |
|
{ |
| 53 |
15 |
this.headers = new TreeMap<String, String>(); |
| 54 |
|
} |
| 55 |
|
|
| |
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
| 56 |
0 |
public Mail(String from, String to, String cc, String bcc, String subject, String textPart, String htmlPart)... |
| 57 |
|
{ |
| 58 |
0 |
this(); |
| 59 |
|
|
| 60 |
0 |
this.from = from; |
| 61 |
0 |
this.to = to; |
| 62 |
0 |
this.cc = cc; |
| 63 |
0 |
this.bcc = bcc; |
| 64 |
0 |
this.subject = subject; |
| 65 |
0 |
this.textPart = textPart; |
| 66 |
0 |
this.htmlPart = htmlPart; |
| 67 |
|
} |
| 68 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 69 |
5 |
public List<Attachment> getAttachments()... |
| 70 |
|
{ |
| 71 |
5 |
return this.attachments; |
| 72 |
|
} |
| 73 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 74 |
1 |
public void setAttachments(List<Attachment> attachments)... |
| 75 |
|
{ |
| 76 |
1 |
this.attachments = attachments; |
| 77 |
|
} |
| 78 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 79 |
18 |
public String getFrom()... |
| 80 |
|
{ |
| 81 |
18 |
return this.from; |
| 82 |
|
} |
| 83 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 84 |
8 |
public void setFrom(String from)... |
| 85 |
|
{ |
| 86 |
8 |
this.from = from; |
| 87 |
|
} |
| 88 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 89 |
14 |
public String getTo()... |
| 90 |
|
{ |
| 91 |
14 |
return this.to; |
| 92 |
|
} |
| 93 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 94 |
5 |
public void setTo(String to)... |
| 95 |
|
{ |
| 96 |
5 |
this.to = to; |
| 97 |
|
} |
| 98 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 99 |
9 |
public String getCc()... |
| 100 |
|
{ |
| 101 |
9 |
return this.cc; |
| 102 |
|
} |
| 103 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 104 |
1 |
public void setCc(String cc)... |
| 105 |
|
{ |
| 106 |
1 |
this.cc = cc; |
| 107 |
|
} |
| 108 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 109 |
9 |
public String getBcc()... |
| 110 |
|
{ |
| 111 |
9 |
return this.bcc; |
| 112 |
|
} |
| 113 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 114 |
1 |
public void setBcc(String bcc)... |
| 115 |
|
{ |
| 116 |
1 |
this.bcc = bcc; |
| 117 |
|
} |
| 118 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 119 |
21 |
public String getSubject()... |
| 120 |
|
{ |
| 121 |
21 |
return this.subject; |
| 122 |
|
} |
| 123 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 124 |
10 |
public void setSubject(String subject)... |
| 125 |
|
{ |
| 126 |
10 |
this.subject = subject; |
| 127 |
|
} |
| 128 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 129 |
22 |
public String getTextPart()... |
| 130 |
|
{ |
| 131 |
22 |
return this.textPart; |
| 132 |
|
} |
| 133 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 134 |
13 |
public void setTextPart(String message)... |
| 135 |
|
{ |
| 136 |
13 |
this.textPart = message; |
| 137 |
|
} |
| 138 |
|
|
| |
|
| 76.5% |
Uncovered Elements: 8 (34) |
Complexity: 9 |
Complexity Density: 0.5 |
|
| 139 |
5 |
@Override... |
| 140 |
|
public String toString() |
| 141 |
|
{ |
| 142 |
5 |
StringBuilder buffer = new StringBuilder(); |
| 143 |
|
|
| 144 |
5 |
if (getFrom() != null) { |
| 145 |
5 |
buffer.append("From [" + getFrom() + "]"); |
| 146 |
|
} |
| 147 |
|
|
| 148 |
5 |
if (getTo() != null) { |
| 149 |
5 |
buffer.append(", To [" + getTo() + "]"); |
| 150 |
|
} |
| 151 |
|
|
| 152 |
5 |
if (getCc() != null) { |
| 153 |
0 |
buffer.append(", Cc [" + getCc() + "]"); |
| 154 |
|
} |
| 155 |
|
|
| 156 |
5 |
if (getBcc() != null) { |
| 157 |
0 |
buffer.append(", Bcc [" + getBcc() + "]"); |
| 158 |
|
} |
| 159 |
|
|
| 160 |
5 |
if (getSubject() != null) { |
| 161 |
5 |
buffer.append(", Subject [" + getSubject() + "]"); |
| 162 |
|
} |
| 163 |
|
|
| 164 |
5 |
if (getTextPart() != null) { |
| 165 |
5 |
buffer.append(", Text [" + getTextPart() + "]"); |
| 166 |
|
} |
| 167 |
|
|
| 168 |
5 |
if (getHtmlPart() != null) { |
| 169 |
1 |
buffer.append(", HTML [" + getHtmlPart() + "]"); |
| 170 |
|
} |
| 171 |
|
|
| 172 |
5 |
if (!getHeaders().isEmpty()) { |
| 173 |
3 |
buffer.append(", Headers [" + toStringHeaders() + "]"); |
| 174 |
|
} |
| 175 |
|
|
| 176 |
5 |
return buffer.toString(); |
| 177 |
|
} |
| 178 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
|
| 179 |
3 |
private String toStringHeaders()... |
| 180 |
|
{ |
| 181 |
3 |
StringBuilder buffer = new StringBuilder(); |
| 182 |
3 |
for (Map.Entry<String, String> header : getHeaders().entrySet()) { |
| 183 |
5 |
buffer.append('['); |
| 184 |
5 |
buffer.append(header.getKey()); |
| 185 |
5 |
buffer.append(']'); |
| 186 |
5 |
buffer.append(' '); |
| 187 |
5 |
buffer.append('='); |
| 188 |
5 |
buffer.append(' '); |
| 189 |
5 |
buffer.append('['); |
| 190 |
5 |
buffer.append(header.getValue()); |
| 191 |
5 |
buffer.append(']'); |
| 192 |
|
} |
| 193 |
3 |
return buffer.toString(); |
| 194 |
|
} |
| 195 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 196 |
13 |
public String getHtmlPart()... |
| 197 |
|
{ |
| 198 |
13 |
return this.htmlPart; |
| 199 |
|
} |
| 200 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 201 |
1 |
public void setHtmlPart(String htmlPart)... |
| 202 |
|
{ |
| 203 |
1 |
this.htmlPart = htmlPart; |
| 204 |
|
} |
| 205 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 206 |
6 |
public void setHeader(String header, String value)... |
| 207 |
|
{ |
| 208 |
6 |
this.headers.put(header, value); |
| 209 |
|
} |
| 210 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 211 |
12 |
public String getHeader(String header)... |
| 212 |
|
{ |
| 213 |
12 |
return this.headers.get(header); |
| 214 |
|
} |
| 215 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 216 |
0 |
public void setHeaders(Map<String, String> headers)... |
| 217 |
|
{ |
| 218 |
0 |
this.headers = headers; |
| 219 |
|
} |
| 220 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 221 |
20 |
public Map<String, String> getHeaders()... |
| 222 |
|
{ |
| 223 |
20 |
return this.headers; |
| 224 |
|
} |
| 225 |
|
} |