Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/GaugeInfoService.java @ 4997:fa2a3ed97464 dami
Remove skip lines documentation line
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 15 Feb 2013 11:55:34 +0100 |
parents | 5e7da178daa6 |
children |
rev | line source |
---|---|
2599
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.services; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import org.w3c.dom.Document; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Element; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import org.apache.log4j.Logger; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifacts.common.utils.XMLUtils; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifacts.CallMeta; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifacts.GlobalContext; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.model.Gauge; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.model.Range; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.flys.model.River; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.flys.artifacts.model.RiverFactory; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 /** |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 */ |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 public class GaugeInfoService extends FLYSService { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 interface Filter { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 boolean apply(Gauge gauge); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
3910
5e7da178daa6
Cosmetics.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3557
diff
changeset
|
35 private static final class ReferenceNumberFilter implements Filter { |
2599
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 private long refNr; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 public ReferenceNumberFilter(long refNr) { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 this.refNr = refNr; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 @Override |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 public boolean apply(Gauge gauge) { |
3910
5e7da178daa6
Cosmetics.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3557
diff
changeset
|
44 if (logger.isDebugEnabled()) { |
5e7da178daa6
Cosmetics.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3557
diff
changeset
|
45 logger.debug("Test gauge '" + gauge.getName() + "'"); |
5e7da178daa6
Cosmetics.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3557
diff
changeset
|
46 } |
2599
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
3910
5e7da178daa6
Cosmetics.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3557
diff
changeset
|
48 return gauge != null && gauge.getOfficialNumber() == refNr; |
2599
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 } // end of ReferenceNumberFilter class |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 /** The logger that is used by this service.*/ |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 private static Logger logger = Logger.getLogger(GaugeInfoService.class); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 public static final String XPATH_RIVERNAME = "/art:river/@name"; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 public static final String XPATH_REFERENCE_NR |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 = "/art:river/art:filter/art:gauge/text()"; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 public GaugeInfoService() { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 @Override |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 public Document doProcess( |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 Document data, |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 GlobalContext context, |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 CallMeta callMeta |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 ) { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 logger.debug("GaugeInfoService.process"); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
3557
f1f798b5f14a
Made expensive XMLUtils.toString() debug output conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2599
diff
changeset
|
75 if (logger.isDebugEnabled()) { |
f1f798b5f14a
Made expensive XMLUtils.toString() debug output conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2599
diff
changeset
|
76 logger.debug(XMLUtils.toString(data)); |
f1f798b5f14a
Made expensive XMLUtils.toString() debug output conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2599
diff
changeset
|
77 } |
2599
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 River river = getRiverFromRequest(data); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 List<Filter> filters = getFilters(data); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 List<Gauge> allGauges = river.getGauges(); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 List<Gauge> filtered = new ArrayList<Gauge>(); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 for (Gauge g: allGauges) { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 for (Filter f: filters) { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 if (f.apply(g)) { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 filtered.add(g); |
3557
f1f798b5f14a
Made expensive XMLUtils.toString() debug output conditional.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2599
diff
changeset
|
89 break; |
2599
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 return buildInfoDocument(filtered); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 protected River getRiverFromRequest(Document data) { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 String rivername = XMLUtils.xpathString( |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 data, |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 XPATH_RIVERNAME, |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 ArtifactNamespaceContext.INSTANCE); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 logger.debug("Return Gauge info for River '" + rivername + "'"); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 return rivername != null ? RiverFactory.getRiver(rivername) : null; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 protected List<Filter> getFilters(Document data) { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 List<Filter> filters = new ArrayList<Filter>(); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 String refNr = XMLUtils.xpathString( |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 data, |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 XPATH_REFERENCE_NR, |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 ArtifactNamespaceContext.INSTANCE); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 if (refNr != null && refNr.length() > 0) { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 try { |
3910
5e7da178daa6
Cosmetics.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3557
diff
changeset
|
120 filters.add( |
5e7da178daa6
Cosmetics.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3557
diff
changeset
|
121 new ReferenceNumberFilter(Long.parseLong(refNr))); |
2599
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 catch (NumberFormatException nfe) { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 logger.warn(nfe, nfe); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 return filters; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 protected Document buildInfoDocument(List<Gauge> gauges) { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 Document doc = XMLUtils.newDocument(); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 ElementCreator cr = new ElementCreator( |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 doc, |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 ArtifactNamespaceContext.NAMESPACE_URI, |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 Element service = cr.create("service"); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 logger.debug("Append " + gauges.size() + " gauges to info doc."); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 for (Gauge g: gauges) { |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 Range r = g.getRange(); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 Element el = cr.create("gauge"); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 cr.addAttr(el, "name", g.getName()); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 cr.addAttr(el, "lower", String.valueOf(r.getA().doubleValue())); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 cr.addAttr(el, "upper", String.valueOf(r.getB().doubleValue())); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 service.appendChild(el); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 doc.appendChild(service); |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 return doc; |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 } |
fb7975828ffa
#544 Added a service that allows querying gauge information.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |