1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.xdomxml10.internal.renderer; |
21 |
|
|
22 |
|
import java.util.Map; |
23 |
|
|
24 |
|
import org.xml.sax.Attributes; |
25 |
|
import org.xml.sax.helpers.AttributesImpl; |
26 |
|
import org.xwiki.rendering.listener.Format; |
27 |
|
import org.xwiki.rendering.listener.HeaderLevel; |
28 |
|
import org.xwiki.rendering.listener.ListType; |
29 |
|
import org.xwiki.rendering.listener.MetaData; |
30 |
|
import org.xwiki.rendering.listener.chaining.ListenerChain; |
31 |
|
import org.xwiki.rendering.listener.reference.ResourceReference; |
32 |
|
import org.xwiki.rendering.syntax.Syntax; |
33 |
|
import org.xwiki.rendering.xdomxml10.internal.XDOMXMLConstants; |
34 |
|
import org.xwiki.rendering.xdomxml10.internal.renderer.parameter.DefaultSerializer; |
35 |
|
import org.xwiki.rendering.xdomxml10.internal.renderer.parameter.FormatConverter; |
36 |
|
import org.xwiki.rendering.xdomxml10.internal.renderer.parameter.HeaderLevelConverter; |
37 |
|
import org.xwiki.rendering.xdomxml10.internal.renderer.parameter.ListTypeConverter; |
38 |
|
import org.xwiki.rendering.xdomxml10.internal.renderer.parameter.ResourceReferenceSerializer; |
39 |
|
import org.xwiki.rendering.xml.internal.renderer.AbstractChainingContentHandlerStreamRenderer; |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
@version |
45 |
|
|
|
|
| 26% |
Uncovered Elements: 208 (281) |
Complexity: 99 |
Complexity Density: 0.63 |
|
46 |
|
public class XDOMXMLChainingStreamRenderer extends AbstractChainingContentHandlerStreamRenderer |
47 |
|
{ |
48 |
|
private static final DefaultSerializer SERIALIZER = new DefaultSerializer(); |
49 |
|
|
50 |
|
private static final String VERSION = "1.0"; |
51 |
|
|
52 |
|
private FormatConverter formatConverter = new FormatConverter(); |
53 |
|
|
54 |
|
private HeaderLevelConverter headerLevelConverter = new HeaderLevelConverter(); |
55 |
|
|
56 |
|
private ListTypeConverter listTypeConverter = new ListTypeConverter(); |
57 |
|
|
58 |
|
private ResourceReferenceSerializer linkSerializer = new ResourceReferenceSerializer(); |
59 |
|
|
60 |
|
private boolean versionSerialized = false; |
61 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
2 |
public XDOMXMLChainingStreamRenderer(ListenerChain listenerChain)... |
63 |
|
{ |
64 |
2 |
setListenerChain(listenerChain); |
65 |
|
} |
66 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
67 |
0 |
@Override... |
68 |
|
public Syntax getSyntax() |
69 |
|
{ |
70 |
0 |
return Syntax.XDOMXML_1_0; |
71 |
|
} |
72 |
|
|
73 |
|
|
74 |
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
75 |
2 |
@Override... |
76 |
|
public void beginDocument(MetaData metadata) |
77 |
|
{ |
78 |
2 |
startBlock("document"); |
79 |
|
|
80 |
2 |
if (!metadata.getMetaData().isEmpty()) { |
81 |
2 |
serializeParameter("metaData", metadata, false); |
82 |
|
} |
83 |
|
} |
84 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
85 |
0 |
@Override... |
86 |
|
public void beginGroup(Map<String, String> parameters) |
87 |
|
{ |
88 |
0 |
startBlock("group", parameters); |
89 |
|
} |
90 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
91 |
0 |
@Override... |
92 |
|
public void beginFormat(Format format, Map<String, String> parameters) |
93 |
|
{ |
94 |
0 |
startBlock("format", parameters); |
95 |
|
|
96 |
0 |
serializeParameter("format", this.formatConverter.toString(format), false); |
97 |
|
} |
98 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
99 |
0 |
@Override... |
100 |
|
public void beginParagraph(Map<String, String> parameters) |
101 |
|
{ |
102 |
0 |
startBlock("paragraph", parameters); |
103 |
|
} |
104 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
105 |
0 |
@Override... |
106 |
|
public void beginLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters) |
107 |
|
{ |
108 |
0 |
startBlock("link", parameters); |
109 |
|
|
110 |
0 |
this.linkSerializer.serialize(reference, getContentHandler()); |
111 |
0 |
if (freestanding) { |
112 |
0 |
serializeParameter("freestanding", freestanding, false); |
113 |
|
} |
114 |
|
} |
115 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
0 |
@Override... |
117 |
|
public void beginSection(Map<String, String> parameters) |
118 |
|
{ |
119 |
0 |
startBlock("section", parameters); |
120 |
|
} |
121 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
122 |
0 |
@Override... |
123 |
|
public void beginHeader(HeaderLevel level, String id, Map<String, String> parameters) |
124 |
|
{ |
125 |
0 |
startBlock("header", parameters); |
126 |
|
|
127 |
0 |
serializeParameter("level", this.headerLevelConverter.toString(level), false); |
128 |
0 |
serializeParameter("id", id, false); |
129 |
|
} |
130 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
131 |
0 |
@Override... |
132 |
|
public void beginList(ListType type, Map<String, String> parameters) |
133 |
|
{ |
134 |
0 |
startBlock("list", parameters); |
135 |
|
|
136 |
0 |
serializeParameter("type", this.listTypeConverter.toString(type), false); |
137 |
|
} |
138 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
139 |
0 |
@Override... |
140 |
|
public void beginListItem() |
141 |
|
{ |
142 |
0 |
startBlock("listItem"); |
143 |
|
} |
144 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
145 |
0 |
@Override... |
146 |
|
public void beginDefinitionTerm() |
147 |
|
{ |
148 |
0 |
startBlock("definitionTerm"); |
149 |
|
} |
150 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
151 |
0 |
@Override... |
152 |
|
public void beginDefinitionDescription() |
153 |
|
{ |
154 |
0 |
startBlock("definitionDescription"); |
155 |
|
} |
156 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
157 |
0 |
@Override... |
158 |
|
public void beginTable(Map<String, String> parameters) |
159 |
|
{ |
160 |
0 |
startBlock("table", parameters); |
161 |
|
} |
162 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
163 |
0 |
@Override... |
164 |
|
public void beginTableCell(Map<String, String> parameters) |
165 |
|
{ |
166 |
0 |
startBlock("tableCell", parameters); |
167 |
|
} |
168 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
169 |
0 |
@Override... |
170 |
|
public void beginTableHeadCell(Map<String, String> parameters) |
171 |
|
{ |
172 |
0 |
startBlock("tableHeadCell", parameters); |
173 |
|
} |
174 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
175 |
0 |
@Override... |
176 |
|
public void beginTableRow(Map<String, String> parameters) |
177 |
|
{ |
178 |
0 |
startBlock("tableRow", parameters); |
179 |
|
} |
180 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
181 |
0 |
@Override... |
182 |
|
public void beginQuotation(Map<String, String> parameters) |
183 |
|
{ |
184 |
0 |
startBlock("quotation", parameters); |
185 |
|
} |
186 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
187 |
0 |
@Override... |
188 |
|
public void beginMacroMarker(String id, Map<String, String> parameters, String content, boolean isInline) |
189 |
|
{ |
190 |
0 |
startBlock("macroMarker", parameters); |
191 |
|
|
192 |
0 |
serializeParameter("id", id, false); |
193 |
0 |
if (content != null) { |
194 |
0 |
serializeParameter("content", content, false); |
195 |
|
} |
196 |
0 |
if (isInline) { |
197 |
0 |
serializeParameter("inline", isInline, false); |
198 |
|
} |
199 |
|
} |
200 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
201 |
0 |
@Override... |
202 |
|
public void beginDefinitionList(Map<String, String> parameters) |
203 |
|
{ |
204 |
0 |
startBlock("definitionList", parameters); |
205 |
|
} |
206 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
207 |
0 |
@Override... |
208 |
|
public void beginQuotationLine() |
209 |
|
{ |
210 |
0 |
startBlock("quotationLine"); |
211 |
|
} |
212 |
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
213 |
2 |
@Override... |
214 |
|
public void beginMetaData(MetaData metadata) |
215 |
|
{ |
216 |
2 |
startBlock("metaData"); |
217 |
|
|
218 |
2 |
if (!metadata.getMetaData().isEmpty()) { |
219 |
2 |
serializeParameter("metaData", metadata, false); |
220 |
|
} |
221 |
|
} |
222 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
223 |
2 |
@Override... |
224 |
|
public void endDocument(MetaData metadata) |
225 |
|
{ |
226 |
2 |
endBlock(); |
227 |
|
} |
228 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
229 |
0 |
@Override... |
230 |
|
public void endGroup(Map<String, String> parameters) |
231 |
|
{ |
232 |
0 |
endBlock(); |
233 |
|
} |
234 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
235 |
0 |
@Override... |
236 |
|
public void endFormat(Format format, Map<String, String> parameters) |
237 |
|
{ |
238 |
0 |
endBlock(); |
239 |
|
} |
240 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
241 |
0 |
@Override... |
242 |
|
public void endParagraph(Map<String, String> parameters) |
243 |
|
{ |
244 |
0 |
endBlock(); |
245 |
|
} |
246 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
247 |
0 |
@Override... |
248 |
|
public void endLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters) |
249 |
|
{ |
250 |
0 |
endBlock(); |
251 |
|
} |
252 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
253 |
0 |
@Override... |
254 |
|
public void endSection(Map<String, String> parameters) |
255 |
|
{ |
256 |
0 |
endBlock(); |
257 |
|
} |
258 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
259 |
0 |
@Override... |
260 |
|
public void endHeader(HeaderLevel level, String id, Map<String, String> parameters) |
261 |
|
{ |
262 |
0 |
endBlock(); |
263 |
|
} |
264 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
265 |
0 |
@Override... |
266 |
|
public void endList(ListType type, Map<String, String> parameters) |
267 |
|
{ |
268 |
0 |
endBlock(); |
269 |
|
} |
270 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
271 |
0 |
@Override... |
272 |
|
public void endListItem() |
273 |
|
{ |
274 |
0 |
endBlock(); |
275 |
|
} |
276 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
277 |
0 |
@Override... |
278 |
|
public void endMacroMarker(String name, Map<String, String> parameters, String content, boolean isInline) |
279 |
|
{ |
280 |
0 |
endBlock(); |
281 |
|
} |
282 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
283 |
0 |
@Override... |
284 |
|
public void endDefinitionList(Map<String, String> parameters) |
285 |
|
{ |
286 |
0 |
endBlock(); |
287 |
|
} |
288 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
289 |
0 |
@Override... |
290 |
|
public void endDefinitionTerm() |
291 |
|
{ |
292 |
0 |
endBlock(); |
293 |
|
} |
294 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
295 |
0 |
@Override... |
296 |
|
public void endDefinitionDescription() |
297 |
|
{ |
298 |
0 |
endBlock(); |
299 |
|
} |
300 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
301 |
0 |
@Override... |
302 |
|
public void endQuotation(Map<String, String> parameters) |
303 |
|
{ |
304 |
0 |
endBlock(); |
305 |
|
} |
306 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
307 |
0 |
@Override... |
308 |
|
public void endQuotationLine() |
309 |
|
{ |
310 |
0 |
endBlock(); |
311 |
|
} |
312 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
313 |
0 |
@Override... |
314 |
|
public void endTable(Map<String, String> parameters) |
315 |
|
{ |
316 |
0 |
endBlock(); |
317 |
|
} |
318 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
319 |
0 |
@Override... |
320 |
|
public void endTableCell(Map<String, String> parameters) |
321 |
|
{ |
322 |
0 |
endBlock(); |
323 |
|
} |
324 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
325 |
0 |
@Override... |
326 |
|
public void endTableHeadCell(Map<String, String> parameters) |
327 |
|
{ |
328 |
0 |
endBlock(); |
329 |
|
} |
330 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
331 |
0 |
@Override... |
332 |
|
public void endTableRow(Map<String, String> parameters) |
333 |
|
{ |
334 |
0 |
endBlock(); |
335 |
|
} |
336 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
337 |
2 |
@Override... |
338 |
|
public void endMetaData(MetaData metadata) |
339 |
|
{ |
340 |
2 |
endBlock(); |
341 |
|
} |
342 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
343 |
0 |
@Override... |
344 |
|
public void onNewLine() |
345 |
|
{ |
346 |
0 |
emptyBlock("newLine"); |
347 |
|
} |
348 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
349 |
0 |
@Override... |
350 |
|
public void onMacro(String id, Map<String, String> parameters, String content, boolean inline) |
351 |
|
{ |
352 |
0 |
startBlock("macro", parameters); |
353 |
|
|
354 |
0 |
serializeParameter("id", id, false); |
355 |
0 |
if (content != null) { |
356 |
0 |
serializeParameter("content", content, false); |
357 |
|
} |
358 |
0 |
if (inline) { |
359 |
0 |
serializeParameter("inline", inline, false); |
360 |
|
} |
361 |
|
|
362 |
0 |
endBlock(); |
363 |
|
} |
364 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
365 |
0 |
@Override... |
366 |
|
public void onWord(String word) |
367 |
|
{ |
368 |
0 |
startBlock("word"); |
369 |
|
|
370 |
0 |
serializeParameter("word", word, false); |
371 |
|
|
372 |
0 |
endBlock(); |
373 |
|
} |
374 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
375 |
0 |
@Override... |
376 |
|
public void onSpace() |
377 |
|
{ |
378 |
0 |
emptyBlock("space"); |
379 |
|
} |
380 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
381 |
0 |
@Override... |
382 |
|
public void onSpecialSymbol(char symbol) |
383 |
|
{ |
384 |
0 |
startBlock("specialSymbol"); |
385 |
|
|
386 |
0 |
serializeParameter("symbol", symbol, false); |
387 |
|
|
388 |
0 |
endBlock(); |
389 |
|
} |
390 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
391 |
0 |
@Override... |
392 |
|
public void onRawText(String text, Syntax syntax) |
393 |
|
{ |
394 |
0 |
startBlock("rawText"); |
395 |
|
|
396 |
0 |
serializeParameter("content", text, false); |
397 |
0 |
serializeParameter("syntax", syntax.toIdString(), false); |
398 |
|
|
399 |
0 |
endBlock(); |
400 |
|
} |
401 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
402 |
0 |
@Override... |
403 |
|
public void onId(String name) |
404 |
|
{ |
405 |
0 |
startBlock("id"); |
406 |
|
|
407 |
0 |
serializeParameter("name", name, false); |
408 |
|
|
409 |
0 |
endBlock(); |
410 |
|
} |
411 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
412 |
0 |
@Override... |
413 |
|
public void onHorizontalLine(Map<String, String> parameters) |
414 |
|
{ |
415 |
0 |
emptyBlock("horizontalLine", parameters); |
416 |
|
} |
417 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
418 |
0 |
@Override... |
419 |
|
public void onEmptyLines(int count) |
420 |
|
{ |
421 |
0 |
startBlock("emptyLines"); |
422 |
|
|
423 |
0 |
if (count > 1) { |
424 |
0 |
serializeParameter("count", count, false); |
425 |
|
} |
426 |
|
|
427 |
0 |
endBlock(); |
428 |
|
} |
429 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
430 |
0 |
@Override... |
431 |
|
public void onVerbatim(String content, boolean inline, Map<String, String> parameters) |
432 |
|
{ |
433 |
0 |
startBlock("verbatim"); |
434 |
|
|
435 |
0 |
serializeParameter("content", content, false); |
436 |
0 |
if (inline) { |
437 |
0 |
serializeParameter("inline", inline, false); |
438 |
|
} |
439 |
|
|
440 |
0 |
endBlock(); |
441 |
|
} |
442 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
443 |
0 |
@Override... |
444 |
|
public void onImage(ResourceReference reference, boolean freestanding, Map<String, String> parameters) |
445 |
|
{ |
446 |
0 |
startBlock("image", parameters); |
447 |
|
|
448 |
0 |
serializeParameter("freestanding", freestanding, false); |
449 |
0 |
this.linkSerializer.serialize(reference, getContentHandler()); |
450 |
|
|
451 |
0 |
endBlock(); |
452 |
|
} |
453 |
|
|
454 |
|
|
455 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
456 |
4 |
private void startBlock(String blockName)... |
457 |
|
{ |
458 |
4 |
startBlock(blockName, null); |
459 |
|
} |
460 |
|
|
|
|
| 83.3% |
Uncovered Elements: 2 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
461 |
4 |
private void startBlock(String blockName, Map<String, String> customParameters)... |
462 |
|
{ |
463 |
4 |
AttributesImpl attributes = new AttributesImpl(); |
464 |
4 |
attributes.addAttribute(null, null, XDOMXMLConstants.ATT_BLOCK_NAME, null, blockName); |
465 |
4 |
if (!this.versionSerialized) { |
466 |
2 |
attributes.addAttribute(null, null, XDOMXMLConstants.ATT_BLOCK_VERSION, null, VERSION); |
467 |
2 |
this.versionSerialized = true; |
468 |
|
} |
469 |
|
|
470 |
4 |
startElement(XDOMXMLConstants.ELEM_BLOCK, attributes); |
471 |
|
|
472 |
4 |
if (customParameters != null) { |
473 |
0 |
serializeCustomParameters(customParameters); |
474 |
|
} |
475 |
|
} |
476 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
477 |
4 |
private void endBlock()... |
478 |
|
{ |
479 |
4 |
endElement(XDOMXMLConstants.ELEM_BLOCK); |
480 |
|
} |
481 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
482 |
0 |
private void emptyBlock(String blockName)... |
483 |
|
{ |
484 |
0 |
startBlock(blockName); |
485 |
0 |
endBlock(); |
486 |
|
} |
487 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
488 |
0 |
private void emptyBlock(String blockName, Map<String, String> customParameters)... |
489 |
|
{ |
490 |
0 |
startBlock(blockName, customParameters); |
491 |
0 |
endBlock(); |
492 |
|
} |
493 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
494 |
0 |
private void serializeCustomParameters(Map<String, String> parameters)... |
495 |
|
{ |
496 |
0 |
if (parameters.size() > 0) { |
497 |
0 |
serializeParameter(XDOMXMLConstants.ELEM_PARAMETERS, parameters, false); |
498 |
|
} |
499 |
|
} |
500 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
501 |
2 |
public void serializeParameter(String name, Map< ? , ? > map, boolean type)... |
502 |
|
{ |
503 |
2 |
SERIALIZER.serializeParameter(name, map, type, getContentHandler()); |
504 |
|
} |
505 |
|
|
|
|
| 66.7% |
Uncovered Elements: 4 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
506 |
4 |
public void serializeParameter(String name, MetaData metadata, boolean type)... |
507 |
|
{ |
508 |
4 |
Attributes attributes; |
509 |
|
|
510 |
4 |
if (type) { |
511 |
0 |
AttributesImpl attributesImpl = new AttributesImpl(); |
512 |
0 |
attributesImpl.addAttribute(null, null, "type", null, "MetaData"); |
513 |
0 |
attributes = attributesImpl; |
514 |
|
} else { |
515 |
4 |
attributes = DefaultSerializer.EMPTY_ATTRIBUTES; |
516 |
|
} |
517 |
|
|
518 |
4 |
startElement(name, attributes); |
519 |
4 |
for (Map.Entry<String, Object> entry : metadata.getMetaData().entrySet()) { |
520 |
8 |
serializeParameter(entry.getKey(), entry.getValue(), true); |
521 |
|
} |
522 |
4 |
endElement(name); |
523 |
|
} |
524 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
525 |
0 |
public void serializeParameter(String name, boolean value, boolean type)... |
526 |
|
{ |
527 |
0 |
SERIALIZER.serializeParameter(name, value, type, getContentHandler()); |
528 |
|
} |
529 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
530 |
0 |
public void serializeParameter(String name, char value, boolean type)... |
531 |
|
{ |
532 |
0 |
SERIALIZER.serializeParameter(name, value, type, getContentHandler()); |
533 |
|
} |
534 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
535 |
0 |
public void serializeParameter(String name, int value, boolean type)... |
536 |
|
{ |
537 |
0 |
SERIALIZER.serializeParameter(name, value, type, getContentHandler()); |
538 |
|
} |
539 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
540 |
4 |
public void serializeParameter(String name, String value, boolean type)... |
541 |
|
{ |
542 |
4 |
SERIALIZER.serializeParameter(name, value, null, getContentHandler()); |
543 |
|
} |
544 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
545 |
0 |
public void serializeParameter(String name, Format value, boolean type)... |
546 |
|
{ |
547 |
0 |
SERIALIZER.serializeParameter(name, this.formatConverter.toString(value), type ? "Format" : null, |
548 |
|
getContentHandler()); |
549 |
|
} |
550 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
551 |
0 |
public void serializeParameter(String name, HeaderLevel value, boolean type)... |
552 |
|
{ |
553 |
0 |
SERIALIZER.serializeParameter(name, this.headerLevelConverter.toString(value), type ? "HeaderLevel" : null, |
554 |
|
getContentHandler()); |
555 |
|
} |
556 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
557 |
0 |
public void serializeParameter(String name, ListType value, boolean type)... |
558 |
|
{ |
559 |
0 |
SERIALIZER.serializeParameter(name, this.listTypeConverter.toString(value), type ? "ListType" : null, |
560 |
|
getContentHandler()); |
561 |
|
} |
562 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
563 |
0 |
public void serializeParameter(String name, ResourceReference value, boolean type)... |
564 |
|
{ |
565 |
0 |
Attributes attributes; |
566 |
|
|
567 |
0 |
if (type) { |
568 |
0 |
AttributesImpl attributesImpl = new AttributesImpl(); |
569 |
0 |
attributesImpl.addAttribute(null, null, "type", null, "ResourceReference"); |
570 |
0 |
attributes = attributesImpl; |
571 |
|
} else { |
572 |
0 |
attributes = DefaultSerializer.EMPTY_ATTRIBUTES; |
573 |
|
} |
574 |
|
|
575 |
0 |
startElement(name, attributes); |
576 |
0 |
this.linkSerializer.serialize(value, getContentHandler()); |
577 |
0 |
endElement(name); |
578 |
|
} |
579 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
580 |
2 |
public void serializeParameter(String name, Number value, boolean type)... |
581 |
|
{ |
582 |
2 |
SERIALIZER.serializeParameter(name, value.toString(), type ? value.getClass().getSimpleName() : null, |
583 |
|
getContentHandler()); |
584 |
|
} |
585 |
|
|
|
|
| 65.6% |
Uncovered Elements: 11 (32) |
Complexity: 9 |
Complexity Density: 0.56 |
|
586 |
8 |
public void serializeParameter(String name, Object value, boolean type)... |
587 |
|
{ |
588 |
8 |
if (value instanceof String) { |
589 |
4 |
serializeParameter(name, (String) value, type); |
590 |
4 |
} else if (value instanceof Number) { |
591 |
2 |
serializeParameter(name, (Number) value, type); |
592 |
2 |
} else if (value instanceof Format) { |
593 |
0 |
serializeParameter(name, (Format) value, type); |
594 |
2 |
} else if (value instanceof HeaderLevel) { |
595 |
0 |
serializeParameter(name, (HeaderLevel) value, type); |
596 |
2 |
} else if (value instanceof ListType) { |
597 |
0 |
serializeParameter(name, (ListType) value, type); |
598 |
2 |
} else if (value instanceof ResourceReference) { |
599 |
0 |
serializeParameter(name, (ResourceReference) value, type); |
600 |
2 |
} else if (value instanceof MetaData) { |
601 |
0 |
serializeParameter(name, (MetaData) value, type); |
602 |
2 |
} else if (value instanceof Map) { |
603 |
2 |
serializeParameter(name, (Map< ? , ? >) value, type); |
604 |
|
} |
605 |
|
} |
606 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
607 |
8 |
private void startElement(String elementName, Attributes attributes)... |
608 |
|
{ |
609 |
8 |
SERIALIZER.startElement(elementName, attributes, getContentHandler()); |
610 |
|
} |
611 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
612 |
8 |
private void endElement(String elementName)... |
613 |
|
{ |
614 |
8 |
SERIALIZER.endElement(elementName, getContentHandler()); |
615 |
|
} |
616 |
|
} |