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.template; |
21 |
|
|
22 |
|
import java.util.ArrayList; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import javax.inject.Inject; |
26 |
|
import javax.inject.Singleton; |
27 |
|
|
28 |
|
import org.xwiki.component.annotation.Component; |
29 |
|
import org.xwiki.context.Execution; |
30 |
|
|
31 |
|
import com.xpn.xwiki.XWikiContext; |
32 |
|
import com.xpn.xwiki.api.Attachment; |
33 |
|
import com.xpn.xwiki.api.Document; |
34 |
|
import com.xpn.xwiki.doc.XWikiAttachment; |
35 |
|
|
36 |
|
|
37 |
|
@link@link |
38 |
|
|
39 |
|
@link |
40 |
|
@link |
41 |
|
|
42 |
|
@version |
43 |
|
@since |
44 |
|
|
45 |
|
@Component |
46 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
47 |
|
public class DefaultAttachmentConverter implements AttachmentConverter |
48 |
|
{ |
49 |
|
@Inject |
50 |
|
private Execution execution; |
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
52 |
3 |
@Override... |
53 |
|
public List<Attachment> convert(List<XWikiAttachment> attachments) |
54 |
|
{ |
55 |
3 |
XWikiContext xwikiContext = getXWikiContext(); |
56 |
3 |
List<Attachment> attachmentList = new ArrayList<>(); |
57 |
3 |
for (XWikiAttachment attachment : attachments) { |
58 |
21 |
attachmentList.add(new Attachment( |
59 |
|
new Document(attachment.getDoc(), xwikiContext), attachment, xwikiContext)); |
60 |
|
} |
61 |
3 |
return attachmentList; |
62 |
|
} |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
64 |
3 |
private XWikiContext getXWikiContext()... |
65 |
|
{ |
66 |
3 |
return (XWikiContext) this.execution.getContext().getProperty(XWikiContext.EXECUTIONCONTEXT_KEY); |
67 |
|
} |
68 |
|
} |