1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.mail.internal.factory.usersandgroups; |
21 |
|
|
22 |
|
import java.util.Iterator; |
23 |
|
import java.util.Map; |
24 |
|
|
25 |
|
import javax.inject.Inject; |
26 |
|
import javax.inject.Named; |
27 |
|
import javax.inject.Singleton; |
28 |
|
import javax.mail.MessagingException; |
29 |
|
import javax.mail.internet.MimeMessage; |
30 |
|
|
31 |
|
import org.xwiki.component.annotation.Component; |
32 |
|
import org.xwiki.context.Execution; |
33 |
|
import org.xwiki.mail.MimeMessageFactory; |
34 |
|
import org.xwiki.mail.internal.factory.AbstractIteratorMimeMessageFactory; |
35 |
|
import org.xwiki.model.reference.DocumentReferenceResolver; |
36 |
|
|
37 |
|
|
38 |
|
@link |
39 |
|
@link |
40 |
|
|
41 |
|
|
42 |
|
@version |
43 |
|
@since |
44 |
|
@since |
45 |
|
|
46 |
|
@Component |
47 |
|
@Named("usersandgroups") |
48 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.17 |
|
49 |
|
public class UsersAndGroupsMimeMessageFactory extends AbstractIteratorMimeMessageFactory |
50 |
|
{ |
51 |
|
private static final String HINT = "hint"; |
52 |
|
|
53 |
|
private static final String SOURCE = "source"; |
54 |
|
|
55 |
|
@Inject |
56 |
|
@Named("explicit") |
57 |
|
private DocumentReferenceResolver<String> explicitDocumentReferenceResolver; |
58 |
|
|
59 |
|
@Inject |
60 |
|
private Execution execution; |
61 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
62 |
6 |
@Override... |
63 |
|
public Iterator<MimeMessage> createMessage(Object sourceObject, Map<String, Object> parameters) |
64 |
|
throws MessagingException |
65 |
|
{ |
66 |
6 |
Map<String, Object> source = getTypedSource(sourceObject, Map.class); |
67 |
|
|
68 |
|
|
69 |
6 |
validateParameters(parameters, HINT, SOURCE); |
70 |
|
|
71 |
|
|
72 |
3 |
String factoryHint = (String) parameters.get(HINT); |
73 |
|
|
74 |
3 |
MimeMessageFactory factory = getInternalMimeMessageFactory(factoryHint); |
75 |
|
|
76 |
2 |
UsersAndGroupsMimeMessageIterator iterator = new UsersAndGroupsMimeMessageIterator(source, factory, parameters, |
77 |
|
this.explicitDocumentReferenceResolver, this.execution); |
78 |
2 |
return iterator; |
79 |
|
} |
80 |
|
} |