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.filter.input; |
21 |
|
|
22 |
|
import java.util.Iterator; |
23 |
|
|
24 |
|
import javax.inject.Singleton; |
25 |
|
|
26 |
|
import org.xwiki.component.annotation.Component; |
27 |
|
import org.xwiki.filter.FilterEventParameters; |
28 |
|
import org.xwiki.filter.FilterException; |
29 |
|
import org.xwiki.filter.instance.input.DocumentInstanceInputProperties; |
30 |
|
import org.xwiki.filter.instance.internal.input.AbstractBeanEntityEventGenerator; |
31 |
|
|
32 |
|
import com.xpn.xwiki.internal.filter.PropertyClassFilter; |
33 |
|
import com.xpn.xwiki.objects.BaseProperty; |
34 |
|
import com.xpn.xwiki.objects.classes.PropertyClass; |
35 |
|
|
36 |
|
|
37 |
|
@version |
38 |
|
@since |
39 |
|
|
40 |
|
@Component |
41 |
|
@Singleton |
|
|
| 93.3% |
Uncovered Elements: 1 (15) |
Complexity: 3 |
Complexity Density: 0.3 |
|
42 |
|
public class PropertyClassEventGenerator |
43 |
|
extends AbstractBeanEntityEventGenerator<PropertyClass, PropertyClassFilter, DocumentInstanceInputProperties> |
44 |
|
{ |
|
|
| 92.9% |
Uncovered Elements: 1 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
45 |
68343 |
@Override... |
46 |
|
public void write(PropertyClass xclassProperty, Object filter, PropertyClassFilter propertyFilter, |
47 |
|
DocumentInstanceInputProperties properties) throws FilterException |
48 |
|
{ |
49 |
|
|
50 |
|
|
51 |
68343 |
FilterEventParameters propertyParameters = FilterEventParameters.EMPTY; |
52 |
|
|
53 |
68343 |
String classType = xclassProperty.getClassType(); |
54 |
68343 |
if (xclassProperty.getClass().getSimpleName().equals(classType + "Class")) { |
55 |
|
|
56 |
|
|
57 |
68343 |
classType = xclassProperty.getClass().getName(); |
58 |
|
} |
59 |
|
|
60 |
68343 |
propertyFilter.beginWikiClassProperty(xclassProperty.getName(), classType, propertyParameters); |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
68343 |
Iterator<BaseProperty<?>> it = xclassProperty.getSortedIterator(); |
67 |
663094 |
while (it.hasNext()) { |
68 |
594751 |
BaseProperty<?> bprop = it.next(); |
69 |
594751 |
propertyFilter.onWikiClassPropertyField(bprop.getName(), bprop.toText(), FilterEventParameters.EMPTY); |
70 |
|
} |
71 |
|
|
72 |
|
|
73 |
|
|
74 |
68343 |
propertyFilter.endWikiClassProperty(xclassProperty.getName(), classType, propertyParameters); |
75 |
|
} |
76 |
|
} |