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.InputSource; |
25 |
|
import org.xwiki.model.EntityType; |
26 |
|
import org.xwiki.model.reference.DocumentReference; |
27 |
|
import org.xwiki.model.reference.EntityReference; |
28 |
|
import org.xwiki.skin.ResourceRepository; |
29 |
|
|
30 |
|
import com.xpn.xwiki.XWikiContext; |
31 |
|
import com.xpn.xwiki.XWikiException; |
32 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
|
|
| 86.7% |
Uncovered Elements: 2 (15) |
Complexity: 5 |
Complexity Density: 0.5 |
|
38 |
|
public abstract class AbstractWikiResource<R extends EntityReference, I extends InputSource> extends |
39 |
|
AbstractResource<I> implements WikiResource<I> |
40 |
|
{ |
41 |
|
protected final Provider<XWikiContext> xcontextProvider; |
42 |
|
|
43 |
|
protected final R reference; |
44 |
|
|
45 |
|
protected final DocumentReference authorReference; |
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
47 |
3 |
public AbstractWikiResource(String id, String path, String resourceName, ResourceRepository repository,... |
48 |
|
R reference, DocumentReference authorReference, Provider<XWikiContext> xcontextProvider) |
49 |
|
{ |
50 |
3 |
super(id, path, resourceName, repository); |
51 |
|
|
52 |
3 |
this.reference = reference; |
53 |
3 |
this.authorReference = authorReference; |
54 |
3 |
this.xcontextProvider = xcontextProvider; |
55 |
|
} |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
3 |
@Override... |
58 |
|
public DocumentReference getAuthorReference() |
59 |
|
{ |
60 |
3 |
return this.authorReference; |
61 |
|
} |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
63 |
3 |
protected XWikiDocument getDocument() throws XWikiException... |
64 |
|
{ |
65 |
3 |
EntityReference documentReference = this.reference.extractReference(EntityType.DOCUMENT); |
66 |
|
|
67 |
3 |
XWikiContext xcontext = this.xcontextProvider.get(); |
68 |
|
|
69 |
3 |
return xcontext.getWiki().getDocument(documentReference, xcontext); |
70 |
|
} |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
3 |
@Override... |
73 |
|
public I getInputSource() throws Exception |
74 |
|
{ |
75 |
3 |
return getInputSourceInternal(getDocument()); |
76 |
|
} |
77 |
|
|
78 |
|
protected abstract I getInputSourceInternal(XWikiDocument document) throws Exception; |
79 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
80 |
0 |
@Override... |
81 |
|
public String getURL(boolean forceSkinAction) throws Exception |
82 |
|
{ |
83 |
0 |
return getURL(getDocument()); |
84 |
|
} |
85 |
|
|
86 |
|
public abstract String getURL(XWikiDocument document) throws Exception; |
87 |
|
} |