1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package de.smartics.properties.reports;
17
18 import java.io.IOException;
19 import java.io.OutputStream;
20
21 import javax.annotation.concurrent.NotThreadSafe;
22
23 import org.jdom.Document;
24
25 import de.smartics.properties.api.core.domain.DocumentMetaData;
26 import de.smartics.properties.report.data.PropertyReportSet;
27 import de.smartics.properties.utils.HtmlUtils;
28
29
30
31
32 @NotThreadSafe
33 class XmlPropertySetReporter extends AbstractReporter
34 {
35
36
37
38
39
40
41
42 private static final String NAMESPACE =
43 "http://www.smartics.de/schema/projectdoc/doctype/property-set/1";
44
45
46
47
48
49
50 private final PropertyReportSet reportSet;
51
52
53
54
55 private final HtmlUtils htmlUtils;
56
57
58
59
60
61 XmlPropertySetReporter(final String encoding, final PropertyReportSet reportSet)
62 {
63 super(NAMESPACE);
64 this.reportSet = reportSet;
65 this.htmlUtils = new HtmlUtils(encoding);
66 }
67
68
69
70
71
72
73
74
75
76
77
78 void write(final OutputStream out) throws IOException
79 {
80 final Document document = buildDocument("property-set");
81 final String comment = htmlUtils.clean(getComment());
82 writeSpecification(comment);
83 writeXml(out, document);
84 }
85
86 @Override
87 protected DocumentMetaData getMetaData()
88 {
89 return reportSet.getMetaData();
90 }
91
92 @Override
93 protected String getComment()
94 {
95 final String comment = reportSet.getComment();
96 final String cleanComment = htmlUtils.clean(comment);
97 return cleanComment;
98 }
99
100 @Override
101 protected String getName()
102 {
103 return reportSet.getName();
104 }
105
106 @Override
107 protected String getSpace()
108 {
109 return reportSet.getSpace();
110 }
111
112 @Override
113 protected String getTitle()
114 {
115 return reportSet.getTitle();
116 }
117
118
119
120 }