1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.model.script; |
21 |
|
|
22 |
|
import java.util.Arrays; |
23 |
|
import java.util.List; |
24 |
|
import java.util.Locale; |
25 |
|
|
26 |
|
import javax.inject.Inject; |
27 |
|
import javax.inject.Named; |
28 |
|
import javax.inject.Singleton; |
29 |
|
|
30 |
|
import org.apache.commons.lang3.StringUtils; |
31 |
|
import org.slf4j.Logger; |
32 |
|
import org.xwiki.component.annotation.Component; |
33 |
|
import org.xwiki.component.manager.ComponentLookupException; |
34 |
|
import org.xwiki.component.manager.ComponentManager; |
35 |
|
import org.xwiki.model.EntityType; |
36 |
|
import org.xwiki.model.reference.AttachmentReference; |
37 |
|
import org.xwiki.model.reference.ClassPropertyReference; |
38 |
|
import org.xwiki.model.reference.DocumentReference; |
39 |
|
import org.xwiki.model.reference.DocumentReferenceResolver; |
40 |
|
import org.xwiki.model.reference.EntityReference; |
41 |
|
import org.xwiki.model.reference.EntityReferenceProvider; |
42 |
|
import org.xwiki.model.reference.EntityReferenceResolver; |
43 |
|
import org.xwiki.model.reference.EntityReferenceSerializer; |
44 |
|
import org.xwiki.model.reference.EntityReferenceTree; |
45 |
|
import org.xwiki.model.reference.EntityReferenceValueProvider; |
46 |
|
import org.xwiki.model.reference.ObjectPropertyReference; |
47 |
|
import org.xwiki.model.reference.ObjectReference; |
48 |
|
import org.xwiki.model.reference.SpaceReference; |
49 |
|
import org.xwiki.model.reference.WikiReference; |
50 |
|
import org.xwiki.script.service.ScriptService; |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
@version |
56 |
|
@since |
57 |
|
|
58 |
|
@Component |
59 |
|
@Named("model") |
60 |
|
@Singleton |
|
|
| 79.3% |
Uncovered Elements: 28 (135) |
Complexity: 52 |
Complexity Density: 0.58 |
|
61 |
|
public class ModelScriptService implements ScriptService |
62 |
|
{ |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
private static final String DEFAULT_RESOLVER_HINT = "current"; |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
private static final String DEFAULT_SERIALIZER_HINT = "compact"; |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
@Inject |
77 |
|
private Logger logger; |
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
@Inject |
83 |
|
private ComponentManager componentManager; |
84 |
|
|
85 |
|
@Inject |
86 |
|
private EntityReferenceSerializer<String> defaultSerializer; |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
@value |
91 |
|
|
92 |
|
@param |
93 |
|
@param |
94 |
|
@param |
95 |
|
@return |
96 |
|
@since |
97 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
8820 |
public DocumentReference createDocumentReference(String wiki, String space, String page)... |
99 |
|
{ |
100 |
8820 |
return createDocumentReference(wiki, space, page, DEFAULT_RESOLVER_HINT); |
101 |
|
} |
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
@value |
106 |
|
|
107 |
|
@param |
108 |
|
@param |
109 |
|
@param |
110 |
|
@return |
111 |
|
@since |
112 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
113 |
1 |
public DocumentReference createDocumentReference(String wiki, List<String> spaces, String page)... |
114 |
|
{ |
115 |
1 |
return createDocumentReference(wiki, spaces, page, DEFAULT_RESOLVER_HINT); |
116 |
|
} |
117 |
|
|
118 |
|
|
119 |
|
@link |
120 |
|
|
121 |
|
@param |
122 |
|
@param |
123 |
|
@return |
124 |
|
@since |
125 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
126 |
2 |
public DocumentReference createDocumentReference(DocumentReference reference, Locale locale)... |
127 |
|
{ |
128 |
2 |
return new DocumentReference(reference, locale); |
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
|
@link |
133 |
|
|
134 |
|
@param |
135 |
|
@param |
136 |
|
@return@link |
137 |
|
@since |
138 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
139 |
39 |
public DocumentReference createDocumentReference(String pageName, SpaceReference parent)... |
140 |
|
{ |
141 |
39 |
return new DocumentReference(pageName, parent); |
142 |
|
} |
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
@param |
150 |
|
@param |
151 |
|
@param |
152 |
|
@param |
153 |
|
@return |
154 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
155 |
8828 |
public DocumentReference createDocumentReference(String wiki, String space, String page, String hint)... |
156 |
|
{ |
157 |
8828 |
return createDocumentReference(wiki, StringUtils.isEmpty(space) ? null : Arrays.asList(space), page, hint); |
158 |
|
} |
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
@param |
166 |
|
@param |
167 |
|
@param |
168 |
|
@param |
169 |
|
@return |
170 |
|
|
171 |
|
@since |
172 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 7 |
Complexity Density: 0.39 |
|
173 |
8831 |
public DocumentReference createDocumentReference(String wiki, List<String> spaces, String page, String hint)... |
174 |
|
{ |
175 |
8831 |
EntityReference reference = null; |
176 |
8831 |
if (!StringUtils.isEmpty(wiki)) { |
177 |
7459 |
reference = new EntityReference(wiki, EntityType.WIKI); |
178 |
|
} |
179 |
|
|
180 |
8831 |
if (spaces != null && !spaces.isEmpty()) { |
181 |
8578 |
for (String space : spaces) { |
182 |
8579 |
reference = new EntityReference(space, EntityType.SPACE, reference); |
183 |
|
} |
184 |
|
} |
185 |
8831 |
if (!StringUtils.isEmpty(page)) { |
186 |
8581 |
reference = new EntityReference(page, EntityType.DOCUMENT, reference); |
187 |
|
} |
188 |
|
|
189 |
8831 |
DocumentReference documentReference; |
190 |
8831 |
try { |
191 |
8831 |
DocumentReferenceResolver<EntityReference> resolver = |
192 |
|
this.componentManager.getInstance(DocumentReferenceResolver.TYPE_REFERENCE, hint); |
193 |
8828 |
documentReference = resolver.resolve(reference); |
194 |
|
} catch (ComponentLookupException e) { |
195 |
2 |
try { |
196 |
|
|
197 |
|
|
198 |
2 |
DocumentReferenceResolver<EntityReference> drr = |
199 |
|
this.componentManager.getInstance(DocumentReferenceResolver.class, hint); |
200 |
1 |
documentReference = drr.resolve(reference); |
201 |
1 |
this.logger.warn("Deprecated usage of DocumentReferenceResolver with hint [{}]. " |
202 |
|
+ "Please consider using a DocumentReferenceResolver that takes into account generic types.", hint); |
203 |
|
} catch (ComponentLookupException ex) { |
204 |
1 |
documentReference = null; |
205 |
|
} |
206 |
|
} |
207 |
8831 |
return documentReference; |
208 |
|
} |
209 |
|
|
210 |
|
|
211 |
|
@link |
212 |
|
|
213 |
|
@param |
214 |
|
@param |
215 |
|
@return |
216 |
|
@since |
217 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
218 |
3 |
public AttachmentReference createAttachmentReference(DocumentReference documentReference, String fileName)... |
219 |
|
{ |
220 |
3 |
return new AttachmentReference(fileName, documentReference); |
221 |
|
} |
222 |
|
|
223 |
|
|
224 |
|
@link |
225 |
|
|
226 |
|
@param |
227 |
|
@return |
228 |
|
@since |
229 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
230 |
28 |
public WikiReference createWikiReference(String wikiName)... |
231 |
|
{ |
232 |
28 |
return new WikiReference(wikiName); |
233 |
|
} |
234 |
|
|
235 |
|
|
236 |
|
@link |
237 |
|
|
238 |
|
@param |
239 |
|
@param |
240 |
|
@return |
241 |
|
@since |
242 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
243 |
1 |
public SpaceReference createSpaceReference(String spaceName, WikiReference parent)... |
244 |
|
{ |
245 |
1 |
return new SpaceReference(spaceName, parent); |
246 |
|
} |
247 |
|
|
248 |
|
|
249 |
|
@link |
250 |
|
|
251 |
|
@param |
252 |
|
@param |
253 |
|
@return |
254 |
|
@since |
255 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
256 |
2 |
public SpaceReference createSpaceReference(String spaceName, SpaceReference parent)... |
257 |
|
{ |
258 |
2 |
return new SpaceReference(spaceName, parent); |
259 |
|
} |
260 |
|
|
261 |
|
|
262 |
|
@link |
263 |
|
|
264 |
|
@param |
265 |
|
@param |
266 |
|
@return |
267 |
|
@since |
268 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
269 |
1 |
public SpaceReference createSpaceReference(List<String> spaces, WikiReference parent)... |
270 |
|
{ |
271 |
1 |
SpaceReference spaceReference = null; |
272 |
1 |
EntityReference parentReference = parent; |
273 |
1 |
for (String space : spaces) { |
274 |
3 |
spaceReference = new SpaceReference(space, parentReference); |
275 |
3 |
parentReference = spaceReference; |
276 |
|
} |
277 |
1 |
return spaceReference; |
278 |
|
} |
279 |
|
|
280 |
|
|
281 |
|
@link |
282 |
|
|
283 |
|
@param |
284 |
|
@param |
285 |
|
@return |
286 |
|
@since |
287 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
288 |
2 |
public EntityReference createEntityReference(String name, EntityType type)... |
289 |
|
{ |
290 |
2 |
return new EntityReference(name, type); |
291 |
|
} |
292 |
|
|
293 |
|
|
294 |
|
@link |
295 |
|
|
296 |
|
@param |
297 |
|
@param |
298 |
|
@param |
299 |
|
@return |
300 |
|
@since |
301 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
302 |
310 |
public EntityReference createEntityReference(String name, EntityType type, EntityReference parent)... |
303 |
|
{ |
304 |
310 |
return new EntityReference(name, type, parent); |
305 |
|
} |
306 |
|
|
307 |
|
|
308 |
|
@param |
309 |
|
|
310 |
|
@param |
311 |
|
|
312 |
|
@return@value |
313 |
|
@since |
314 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
315 |
6894 |
public SpaceReference resolveSpace(String stringRepresentation, Object... parameters)... |
316 |
|
{ |
317 |
6894 |
return resolveSpace(stringRepresentation, DEFAULT_RESOLVER_HINT, parameters); |
318 |
|
} |
319 |
|
|
320 |
|
|
321 |
|
@param |
322 |
|
|
323 |
|
@param |
324 |
|
|
325 |
|
@param |
326 |
|
|
327 |
|
@return |
328 |
|
@since |
329 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
330 |
6895 |
public SpaceReference resolveSpace(String stringRepresentation, String hint, Object... parameters)... |
331 |
|
{ |
332 |
6895 |
try { |
333 |
6895 |
EntityReferenceResolver<String> resolver = |
334 |
|
this.componentManager.getInstance(EntityReferenceResolver.TYPE_STRING, hint); |
335 |
6897 |
return new SpaceReference(resolver.resolve(stringRepresentation, EntityType.SPACE, parameters)); |
336 |
|
} catch (ComponentLookupException e) { |
337 |
0 |
return null; |
338 |
|
} |
339 |
|
} |
340 |
|
|
341 |
|
|
342 |
|
@param |
343 |
|
|
344 |
|
@param |
345 |
|
|
346 |
|
@return@value |
347 |
|
@since |
348 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
349 |
13983 |
public DocumentReference resolveDocument(String stringRepresentation, Object... parameters)... |
350 |
|
{ |
351 |
13983 |
return resolveDocument(stringRepresentation, DEFAULT_RESOLVER_HINT, parameters); |
352 |
|
} |
353 |
|
|
354 |
|
|
355 |
|
@param |
356 |
|
|
357 |
|
@param |
358 |
|
|
359 |
|
@param |
360 |
|
|
361 |
|
@return |
362 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
363 |
28832 |
public DocumentReference resolveDocument(String stringRepresentation, String hint, Object... parameters)... |
364 |
|
{ |
365 |
28835 |
try { |
366 |
28834 |
EntityReferenceResolver<String> resolver = |
367 |
|
this.componentManager.getInstance(EntityReferenceResolver.TYPE_STRING, hint); |
368 |
28835 |
return new DocumentReference(resolver.resolve(stringRepresentation, EntityType.DOCUMENT, parameters)); |
369 |
|
} catch (ComponentLookupException e) { |
370 |
0 |
return null; |
371 |
|
} |
372 |
|
} |
373 |
|
|
374 |
|
|
375 |
|
@param@link |
376 |
|
|
377 |
|
@param |
378 |
|
|
379 |
|
@return@link |
380 |
|
@value |
381 |
|
@since |
382 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
383 |
51 |
public AttachmentReference resolveAttachment(String stringRepresentation, Object... parameters)... |
384 |
|
{ |
385 |
51 |
return resolveAttachment(stringRepresentation, DEFAULT_RESOLVER_HINT, parameters); |
386 |
|
} |
387 |
|
|
388 |
|
|
389 |
|
@param@link |
390 |
|
|
391 |
|
@param |
392 |
|
|
393 |
|
@param |
394 |
|
|
395 |
|
@return@link |
396 |
|
@since |
397 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
398 |
51 |
public AttachmentReference resolveAttachment(String stringRepresentation, String hint, Object... parameters)... |
399 |
|
{ |
400 |
51 |
try { |
401 |
51 |
EntityReferenceResolver<String> resolver = |
402 |
|
this.componentManager.getInstance(EntityReferenceResolver.TYPE_STRING, hint); |
403 |
51 |
return new AttachmentReference(resolver.resolve(stringRepresentation, EntityType.ATTACHMENT, parameters)); |
404 |
|
} catch (ComponentLookupException e) { |
405 |
0 |
return null; |
406 |
|
} |
407 |
|
} |
408 |
|
|
409 |
|
|
410 |
|
@param@link |
411 |
|
|
412 |
|
@param |
413 |
|
|
414 |
|
@return@link |
415 |
|
@value |
416 |
|
@since |
417 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
418 |
0 |
public ObjectReference resolveObject(String stringRepresentation, Object... parameters)... |
419 |
|
{ |
420 |
0 |
return resolveObject(stringRepresentation, DEFAULT_RESOLVER_HINT, parameters); |
421 |
|
} |
422 |
|
|
423 |
|
|
424 |
|
@param@link |
425 |
|
|
426 |
|
@param |
427 |
|
|
428 |
|
@param |
429 |
|
|
430 |
|
@return@link |
431 |
|
@since |
432 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
433 |
0 |
public ObjectReference resolveObject(String stringRepresentation, String hint, Object... parameters)... |
434 |
|
{ |
435 |
0 |
try { |
436 |
0 |
EntityReferenceResolver<String> resolver = |
437 |
|
this.componentManager.getInstance(EntityReferenceResolver.TYPE_STRING, hint); |
438 |
0 |
return new ObjectReference(resolver.resolve(stringRepresentation, EntityType.OBJECT, parameters)); |
439 |
|
} catch (ComponentLookupException e) { |
440 |
0 |
return null; |
441 |
|
} |
442 |
|
} |
443 |
|
|
444 |
|
|
445 |
|
@param@link |
446 |
|
|
447 |
|
@param |
448 |
|
|
449 |
|
@return@link |
450 |
|
@value |
451 |
|
@since |
452 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
453 |
0 |
public ObjectPropertyReference resolveObjectProperty(String stringRepresentation, Object... parameters)... |
454 |
|
{ |
455 |
0 |
return resolveObjectProperty(stringRepresentation, DEFAULT_RESOLVER_HINT, parameters); |
456 |
|
} |
457 |
|
|
458 |
|
|
459 |
|
@param@link |
460 |
|
|
461 |
|
@param |
462 |
|
|
463 |
|
@param |
464 |
|
|
465 |
|
@return@link |
466 |
|
@since |
467 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
468 |
0 |
public ObjectPropertyReference resolveObjectProperty(String stringRepresentation, String hint, Object... parameters)... |
469 |
|
{ |
470 |
0 |
try { |
471 |
0 |
EntityReferenceResolver<String> resolver = |
472 |
|
this.componentManager.getInstance(EntityReferenceResolver.TYPE_STRING, hint); |
473 |
0 |
return new ObjectPropertyReference(resolver.resolve(stringRepresentation, EntityType.OBJECT_PROPERTY, |
474 |
|
parameters)); |
475 |
|
} catch (ComponentLookupException e) { |
476 |
0 |
return null; |
477 |
|
} |
478 |
|
} |
479 |
|
|
480 |
|
|
481 |
|
@param@link |
482 |
|
|
483 |
|
@param |
484 |
|
|
485 |
|
@return@link |
486 |
|
@value |
487 |
|
@since |
488 |
|
@since |
489 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
490 |
0 |
public ClassPropertyReference resolveClassProperty(String stringRepresentation, Object... parameters)... |
491 |
|
{ |
492 |
0 |
return resolveClassProperty(stringRepresentation, DEFAULT_RESOLVER_HINT, parameters); |
493 |
|
} |
494 |
|
|
495 |
|
|
496 |
|
@param@link |
497 |
|
|
498 |
|
@param |
499 |
|
|
500 |
|
@param |
501 |
|
|
502 |
|
@return@link |
503 |
|
@since |
504 |
|
@since |
505 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
506 |
1 |
public ClassPropertyReference resolveClassProperty(String stringRepresentation, String hint, Object... parameters)... |
507 |
|
{ |
508 |
1 |
try { |
509 |
1 |
EntityReferenceResolver<String> resolver = |
510 |
|
this.componentManager.getInstance(EntityReferenceResolver.TYPE_STRING, hint); |
511 |
1 |
return new ClassPropertyReference(resolver.resolve(stringRepresentation, EntityType.CLASS_PROPERTY, |
512 |
|
parameters)); |
513 |
|
} catch (ComponentLookupException e) { |
514 |
0 |
return null; |
515 |
|
} |
516 |
|
} |
517 |
|
|
518 |
|
|
519 |
|
@param |
520 |
|
@return |
521 |
|
@param |
522 |
|
@link |
523 |
|
@since |
524 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
525 |
45 |
public String serialize(EntityReference reference, Object... parameters)... |
526 |
|
{ |
527 |
45 |
return serialize(reference, DEFAULT_SERIALIZER_HINT, parameters); |
528 |
|
} |
529 |
|
|
530 |
|
|
531 |
|
@param |
532 |
|
@param |
533 |
|
@param |
534 |
|
@link |
535 |
|
@return |
536 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
537 |
13290 |
public String serialize(EntityReference reference, String hint, Object... parameters)... |
538 |
|
{ |
539 |
13290 |
String result; |
540 |
13289 |
try { |
541 |
13289 |
EntityReferenceSerializer<String> serializer = |
542 |
|
this.componentManager.getInstance(EntityReferenceSerializer.TYPE_STRING, hint); |
543 |
13290 |
result = serializer.serialize(reference, parameters); |
544 |
|
} catch (ComponentLookupException e) { |
545 |
0 |
result = null; |
546 |
|
} |
547 |
13289 |
return result; |
548 |
|
} |
549 |
|
|
550 |
|
|
551 |
|
|
552 |
|
|
553 |
|
|
554 |
|
@param |
555 |
|
|
556 |
|
@return |
557 |
|
@since |
558 |
|
@deprecated@link |
559 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
560 |
2 |
@Deprecated... |
561 |
|
public String getEntityReferenceValue(EntityType type) |
562 |
|
{ |
563 |
2 |
return getEntityReferenceValue(type, DEFAULT_RESOLVER_HINT); |
564 |
|
} |
565 |
|
|
566 |
|
|
567 |
|
|
568 |
|
|
569 |
|
|
570 |
|
@param |
571 |
|
|
572 |
|
@param |
573 |
|
|
574 |
|
@return |
575 |
|
|
576 |
|
@since |
577 |
|
@deprecated@link |
578 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
579 |
3 |
@Deprecated... |
580 |
|
public String getEntityReferenceValue(EntityType type, String hint) |
581 |
|
{ |
582 |
3 |
if (type == null) { |
583 |
1 |
return null; |
584 |
|
} |
585 |
|
|
586 |
2 |
try { |
587 |
2 |
EntityReferenceValueProvider provider = |
588 |
|
this.componentManager.getInstance(EntityReferenceValueProvider.class, hint); |
589 |
1 |
return provider.getDefaultValue(type); |
590 |
|
} catch (ComponentLookupException ex) { |
591 |
1 |
return null; |
592 |
|
} |
593 |
|
} |
594 |
|
|
595 |
|
|
596 |
|
|
597 |
|
|
598 |
|
|
599 |
|
@param |
600 |
|
|
601 |
|
@return |
602 |
|
|
603 |
|
@since |
604 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
605 |
6828 |
public EntityReference getEntityReference(EntityType type)... |
606 |
|
{ |
607 |
6828 |
return getEntityReference(type, DEFAULT_RESOLVER_HINT); |
608 |
|
} |
609 |
|
|
610 |
|
|
611 |
|
|
612 |
|
|
613 |
|
|
614 |
|
@param |
615 |
|
|
616 |
|
@param@link |
617 |
|
|
618 |
|
@return |
619 |
|
|
620 |
|
@since |
621 |
|
|
|
|
| 62.5% |
Uncovered Elements: 3 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
622 |
8497 |
public EntityReference getEntityReference(EntityType type, String hint)... |
623 |
|
{ |
624 |
8498 |
if (type == null) { |
625 |
0 |
return null; |
626 |
|
} |
627 |
|
|
628 |
8498 |
try { |
629 |
8498 |
EntityReferenceProvider provider = this.componentManager.getInstance(EntityReferenceProvider.class, hint); |
630 |
8498 |
return provider.getDefaultReference(type); |
631 |
|
} catch (ComponentLookupException ex) { |
632 |
0 |
return null; |
633 |
|
} |
634 |
|
} |
635 |
|
|
636 |
|
|
637 |
|
|
638 |
|
|
639 |
|
@param |
640 |
|
@return |
641 |
|
@since |
642 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
643 |
7 |
public EntityReferenceTree toTree(Iterable< ? extends EntityReference> references)... |
644 |
|
{ |
645 |
7 |
return new EntityReferenceTree(references); |
646 |
|
} |
647 |
|
|
648 |
|
|
649 |
|
|
650 |
|
|
651 |
|
@param |
652 |
|
@return |
653 |
|
@since |
654 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
655 |
0 |
public EntityReferenceTree toTree(EntityReference... references)... |
656 |
|
{ |
657 |
0 |
return new EntityReferenceTree(references); |
658 |
|
} |
659 |
|
|
660 |
|
|
661 |
|
|
662 |
|
|
663 |
|
@param |
664 |
|
@param |
665 |
|
@return |
666 |
|
@since |
667 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
668 |
0 |
public String escape(String name, EntityType type)... |
669 |
|
{ |
670 |
0 |
return this.defaultSerializer.serialize(new EntityReference(name, type)); |
671 |
|
} |
672 |
|
} |