1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.internal.skin; |
21 |
|
|
22 |
|
import javax.inject.Provider; |
23 |
|
|
24 |
|
import org.xwiki.filter.input.DefaultInputStreamInputSource; |
25 |
|
import org.xwiki.filter.input.InputStreamInputSource; |
26 |
|
import org.xwiki.model.reference.AttachmentReference; |
27 |
|
import org.xwiki.model.reference.DocumentReference; |
28 |
|
import org.xwiki.skin.ResourceRepository; |
29 |
|
|
30 |
|
import com.xpn.xwiki.XWikiContext; |
31 |
|
import com.xpn.xwiki.doc.XWikiAttachment; |
32 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 3 |
Complexity Density: 0.75 |
|
38 |
|
public class AttachmentWikiResource extends AbstractWikiResource<AttachmentReference, InputStreamInputSource> |
39 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
40 |
1 |
public AttachmentWikiResource(String path, ResourceRepository repository, AttachmentReference reference,... |
41 |
|
DocumentReference authorReference, Provider<XWikiContext> xcontextProvider) |
42 |
|
{ |
43 |
1 |
super(path, path, reference.getName(), repository, reference, authorReference, xcontextProvider); |
44 |
|
} |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
46 |
1 |
@Override... |
47 |
|
protected InputStreamInputSource getInputSourceInternal(XWikiDocument document) throws Exception |
48 |
|
{ |
49 |
1 |
XWikiAttachment attachment = document.getAttachment(this.reference.getName()); |
50 |
|
|
51 |
1 |
return new DefaultInputStreamInputSource(attachment.getContentInputStream(this.xcontextProvider.get()), true); |
52 |
|
} |
53 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
54 |
0 |
@Override... |
55 |
|
public String getURL(XWikiDocument document) throws Exception |
56 |
|
{ |
57 |
0 |
return document.getAttachmentURL(this.reference.getName(), "skin", this.xcontextProvider.get()); |
58 |
|
} |
59 |
|
} |