1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| package org.qedeq.kernel.xml.handler.module; |
19 |
| |
20 |
| import org.qedeq.kernel.dto.module.LocationListVo; |
21 |
| import org.qedeq.kernel.dto.module.LocationVo; |
22 |
| import org.qedeq.kernel.dto.module.SpecificationVo; |
23 |
| import org.qedeq.kernel.xml.parser.AbstractSimpleHandler; |
24 |
| import org.qedeq.kernel.xml.parser.SimpleAttributes; |
25 |
| import org.qedeq.kernel.xml.parser.SyntaxException; |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| |
34 |
| public final class SpecificationHandler extends AbstractSimpleHandler { |
35 |
| |
36 |
| |
37 |
| private SpecificationVo specification; |
38 |
| |
39 |
| |
40 |
| private String moduleName; |
41 |
| |
42 |
| |
43 |
| private String ruleVersion; |
44 |
| |
45 |
| |
46 |
| private LocationListVo locations; |
47 |
| |
48 |
| |
49 |
| |
50 |
| |
51 |
| |
52 |
| |
53 |
| |
54 |
81
| public SpecificationHandler(final AbstractSimpleHandler handler) {
|
55 |
81
| super(handler, "SPECIFICATION");
|
56 |
| } |
57 |
| |
58 |
74
| public final void init() {
|
59 |
74
| specification = null;
|
60 |
74
| moduleName = null;
|
61 |
74
| ruleVersion = null;
|
62 |
74
| locations = null;
|
63 |
| } |
64 |
| |
65 |
| |
66 |
| |
67 |
| |
68 |
| |
69 |
| |
70 |
74
| public final SpecificationVo getSpecification() {
|
71 |
74
| return specification;
|
72 |
| } |
73 |
| |
74 |
222
| public final void startElement(final String name, final SimpleAttributes attributes)
|
75 |
| throws SyntaxException { |
76 |
222
| if (getStartTag().equals(name)) {
|
77 |
74
| locations = new LocationListVo();
|
78 |
74
| moduleName = attributes.getString("name");
|
79 |
74
| ruleVersion = attributes.getString("ruleVersion");
|
80 |
148
| } else if ("LOCATIONS".equals(name)) {
|
81 |
| |
82 |
74
| } else if ("LOCATION".equals(name)) {
|
83 |
74
| locations.add(new LocationVo(attributes.getString("value")));
|
84 |
| } else { |
85 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
86 |
| } |
87 |
| } |
88 |
| |
89 |
222
| public final void endElement(final String name) throws SyntaxException {
|
90 |
222
| if (getStartTag().equals(name)) {
|
91 |
74
| specification = new SpecificationVo(moduleName, ruleVersion, locations);
|
92 |
148
| } else if ("LOCATIONS".equals(name)) {
|
93 |
| |
94 |
74
| } else if ("LOCATION".equals(name)) {
|
95 |
| |
96 |
| } else { |
97 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
98 |
| } |
99 |
| } |
100 |
| |
101 |
| } |