1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.filter.script.internal; |
21 |
|
|
22 |
|
import javax.inject.Inject; |
23 |
|
import javax.inject.Named; |
24 |
|
import javax.inject.Provider; |
25 |
|
|
26 |
|
import org.xwiki.component.annotation.Component; |
27 |
|
import org.xwiki.component.annotation.InstantiationStrategy; |
28 |
|
import org.xwiki.component.descriptor.ComponentInstantiationStrategy; |
29 |
|
import org.xwiki.component.phase.Initializable; |
30 |
|
import org.xwiki.component.phase.InitializationException; |
31 |
|
import org.xwiki.filter.internal.job.FilterStreamConverterJob; |
32 |
|
import org.xwiki.model.reference.DocumentReference; |
33 |
|
|
34 |
|
import com.xpn.xwiki.XWikiContext; |
35 |
|
|
36 |
|
|
37 |
|
@link |
38 |
|
@link |
39 |
|
|
40 |
|
@version |
41 |
|
@since |
42 |
|
|
43 |
|
@Component |
44 |
|
@InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP) |
45 |
|
@Named(FilterStreamConverterJob.JOBTYPE) |
|
|
| 73.3% |
Uncovered Elements: 4 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
46 |
|
public class ScriptFilterStreamConverterJob extends FilterStreamConverterJob implements Initializable |
47 |
|
{ |
48 |
|
@Inject |
49 |
|
private Provider<XWikiContext> xcontextProvider; |
50 |
|
|
51 |
|
private String contextWiki; |
52 |
|
|
53 |
|
private DocumentReference contextUser; |
54 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
55 |
1 |
@Override... |
56 |
|
public void initialize() throws InitializationException |
57 |
|
{ |
58 |
1 |
XWikiContext xcontext = this.xcontextProvider.get(); |
59 |
1 |
if (xcontext != null) { |
60 |
1 |
this.contextWiki = xcontext.getWikiId(); |
61 |
1 |
this.contextUser = xcontext.getUserReference(); |
62 |
|
} |
63 |
|
} |
64 |
|
|
|
|
| 57.1% |
Uncovered Elements: 3 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
65 |
1 |
@Override... |
66 |
|
public void run() |
67 |
|
{ |
68 |
|
|
69 |
1 |
XWikiContext xcontext = this.xcontextProvider.get(); |
70 |
1 |
if (xcontext != null) { |
71 |
0 |
xcontext.setWikiId(this.contextWiki); |
72 |
0 |
xcontext.setUserReference(this.contextUser); |
73 |
|
} |
74 |
|
|
75 |
1 |
super.run(); |
76 |
|
} |
77 |
|
} |