1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.kernel.xml.handler.module; |
17 |
|
|
18 |
|
import org.qedeq.kernel.se.dto.module.RenameVo; |
19 |
|
import org.qedeq.kernel.xml.common.XmlSyntaxException; |
20 |
|
import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler; |
21 |
|
import org.qedeq.kernel.xml.handler.common.SimpleAttributes; |
22 |
|
import org.qedeq.kernel.xml.handler.list.ElementHandler; |
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
@author |
29 |
|
|
|
|
| 88.4% |
Uncovered Elements: 5 (43) |
Complexity: 14 |
Complexity Density: 0.64 |
|
30 |
|
public class RenameHandler extends AbstractSimpleHandler { |
31 |
|
|
32 |
|
|
33 |
|
private RenameVo rename; |
34 |
|
|
35 |
|
|
36 |
|
private final ElementHandler subjectVariableHandler; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
@param |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
43 |
197
|
public RenameHandler(final AbstractSimpleHandler handler) {... |
44 |
197
|
super(handler, "RENAME"); |
45 |
197
|
subjectVariableHandler = new ElementHandler(this); |
46 |
|
} |
47 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
48 |
26
|
public final void init() {... |
49 |
26
|
rename = null; |
50 |
|
} |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
@return |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
26
|
public final RenameVo getRenameVo() {... |
58 |
26
|
return rename; |
59 |
|
} |
60 |
|
|
|
|
| 89.5% |
Uncovered Elements: 2 (19) |
Complexity: 5 |
Complexity Density: 0.45 |
|
61 |
70
|
public final void startElement(final String name, final SimpleAttributes attributes)... |
62 |
|
throws XmlSyntaxException { |
63 |
70
|
if (getStartTag().equals(name)) { |
64 |
26
|
rename = new RenameVo(); |
65 |
26
|
final String ref = attributes.getString("ref"); |
66 |
26
|
if (ref != null) { |
67 |
23
|
rename.setReference(ref); |
68 |
|
} |
69 |
26
|
final Integer occurrence = attributes.getInteger("occurrence"); |
70 |
26
|
if (occurrence != null) { |
71 |
18
|
rename.setOccurrence(occurrence.intValue()); |
72 |
|
} |
73 |
44
|
} else if ("VAR".equals(name)) { |
74 |
44
|
changeHandler(subjectVariableHandler, name, attributes); |
75 |
|
} else { |
76 |
0
|
throw XmlSyntaxException.createUnexpectedTagException(name); |
77 |
|
} |
78 |
|
} |
79 |
|
|
|
|
| 80% |
Uncovered Elements: 3 (15) |
Complexity: 6 |
Complexity Density: 0.86 |
|
80 |
70
|
public final void endElement(final String name) throws XmlSyntaxException {... |
81 |
70
|
if (getStartTag().equals(name)) { |
82 |
|
|
83 |
44
|
} else if ("VAR".equals(name)) { |
84 |
44
|
if (rename != null && rename.getOriginalSubjectVariable() == null) { |
85 |
23
|
rename.setOriginalSubjectVariable(subjectVariableHandler.getElement()); |
86 |
21
|
} else if (rename != null) { |
87 |
21
|
rename.setReplacementSubjectVariable(subjectVariableHandler.getElement()); |
88 |
|
} |
89 |
|
} else { |
90 |
0
|
throw XmlSyntaxException.createUnexpectedTagException(name); |
91 |
|
} |
92 |
|
} |
93 |
|
|
94 |
|
} |