1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.edit.script; |
21 |
|
|
22 |
|
import java.lang.reflect.Type; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import javax.inject.Inject; |
26 |
|
import javax.inject.Named; |
27 |
|
import javax.inject.Singleton; |
28 |
|
|
29 |
|
import org.xwiki.component.annotation.Component; |
30 |
|
import org.xwiki.edit.EditConfiguration; |
31 |
|
import org.xwiki.edit.Editor; |
32 |
|
import org.xwiki.edit.EditorManager; |
33 |
|
import org.xwiki.script.service.ScriptService; |
34 |
|
import org.xwiki.script.service.ScriptServiceManager; |
35 |
|
import org.xwiki.stability.Unstable; |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
@version |
41 |
|
@since |
42 |
|
|
43 |
|
@Component |
44 |
|
@Singleton |
45 |
|
@Named(EditScriptService.ROLE_HINT) |
46 |
|
@Unstable |
|
|
| 12.5% |
Uncovered Elements: 14 (16) |
Complexity: 8 |
Complexity Density: 1 |
|
47 |
|
public class EditScriptService implements ScriptService |
48 |
|
{ |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
public static final String ROLE_HINT = "edit"; |
53 |
|
|
54 |
|
@Inject |
55 |
|
private EditorManager editorManager; |
56 |
|
|
57 |
|
@Inject |
58 |
|
private EditConfiguration editConfig; |
59 |
|
|
60 |
|
@Inject |
61 |
|
private ScriptServiceManager scriptServiceManager; |
62 |
|
|
63 |
|
|
64 |
|
@param |
65 |
|
@param |
66 |
|
@return |
67 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
68 |
0 |
public <D> List<Editor<D>> getEditors(Type dataType)... |
69 |
|
{ |
70 |
0 |
return this.editorManager.getEditors(dataType); |
71 |
|
} |
72 |
|
|
73 |
|
|
74 |
|
@param |
75 |
|
@param |
76 |
|
@param |
77 |
|
@return |
78 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
79 |
0 |
public <D> List<Editor<D>> getEditors(Type dataType, String category)... |
80 |
|
{ |
81 |
0 |
return this.editorManager.getEditors(dataType, category); |
82 |
|
} |
83 |
|
|
84 |
|
|
85 |
|
@param |
86 |
|
@param@link |
87 |
|
@param |
88 |
|
@return@link |
89 |
|
|
90 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
91 |
0 |
public <D> Editor<D> getEditor(Type dataType, String hint)... |
92 |
|
{ |
93 |
0 |
return this.editorManager.getEditor(dataType, hint); |
94 |
|
} |
95 |
|
|
96 |
|
|
97 |
|
@param |
98 |
|
@param |
99 |
|
@return |
100 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
101 |
0 |
public <D> Editor<D> getDefaultEditor(Type dataType)... |
102 |
|
{ |
103 |
0 |
return this.editorManager.getDefaultEditor(dataType); |
104 |
|
} |
105 |
|
|
106 |
|
|
107 |
|
@param |
108 |
|
@param |
109 |
|
@param |
110 |
|
@return |
111 |
|
|
112 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
113 |
0 |
public <D> Editor<D> getDefaultEditor(Type dataType, String category)... |
114 |
|
{ |
115 |
0 |
return this.editorManager.getDefaultEditor(dataType, category); |
116 |
|
} |
117 |
|
|
118 |
|
|
119 |
|
@param |
120 |
|
@return |
121 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
122 |
0 |
public String getDefaultEditorId(Type dataType)... |
123 |
|
{ |
124 |
0 |
return this.editConfig.getDefaultEditor(dataType); |
125 |
|
} |
126 |
|
|
127 |
|
|
128 |
|
@param |
129 |
|
@param |
130 |
|
@return |
131 |
|
|
132 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
133 |
0 |
public String getDefaultEditorId(Type dataType, String category)... |
134 |
|
{ |
135 |
0 |
return this.editConfig.getDefaultEditor(dataType, category); |
136 |
|
} |
137 |
|
|
138 |
|
|
139 |
|
@param@link |
140 |
|
@param@link |
141 |
|
@return@link |
142 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
143 |
45 |
@SuppressWarnings("unchecked")... |
144 |
|
public <S extends ScriptService> S get(String serviceName) |
145 |
|
{ |
146 |
45 |
return (S) this.scriptServiceManager.get(ROLE_HINT + "." + serviceName); |
147 |
|
} |
148 |
|
} |