Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/services/MainValuesService.java @ 8856:5e38e2924c07 3.2.x
Fix code style.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:12:01 +0100 |
parents | 30b1ddadf275 |
children | 82c67b859aa7 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8855:d7c005e12af0 | 8856:5e38e2924c07 |
---|---|
44 public class MainValuesService extends D4EService { | 44 public class MainValuesService extends D4EService { |
45 | 45 |
46 /** The log that is used by this service.*/ | 46 /** The log that is used by this service.*/ |
47 private static Logger log = Logger.getLogger(MainValuesService.class); | 47 private static Logger log = Logger.getLogger(MainValuesService.class); |
48 | 48 |
49 /** The XPath that points to the river definition of the incoming request.*/ | 49 /** XPath that points to the river definition of the incoming request.*/ |
50 public static final String XPATH_RIVER = "/art:mainvalues/art:river/text()"; | 50 public static final String XPATH_RIVER = |
51 | 51 "/art:mainvalues/art:river/text()"; |
52 /** The XPath that points to the start definition of the incoming request.*/ | 52 |
53 public static final String XPATH_START = "/art:mainvalues/art:start/text()"; | 53 /** XPath that points to the start definition of the incoming request.*/ |
54 public static final String XPATH_START = | |
55 "/art:mainvalues/art:start/text()"; | |
54 | 56 |
55 /** The XPath that points to the end definition of the incoming request.*/ | 57 /** The XPath that points to the end definition of the incoming request.*/ |
56 public static final String XPATH_END = "/art:mainvalues/art:end/text()"; | 58 public static final String XPATH_END = "/art:mainvalues/art:end/text()"; |
57 | 59 |
58 protected CallMeta callMeta; | 60 protected CallMeta callMeta; |
122 } | 124 } |
123 | 125 |
124 | 126 |
125 /** | 127 /** |
126 * This method extracts the start and end point from incoming request | 128 * This method extracts the start and end point from incoming request |
127 * document and returns both values in an array. If no start and end strings | 129 * document and returns both values in an array. |
130 * If no start and end strings | |
128 * are found in the document, the min/max values of the <i>river</i> are | 131 * are found in the document, the min/max values of the <i>river</i> are |
129 * returned. | 132 * returned. |
130 * | 133 * |
131 * @param data The incoming request data. | 134 * @param data The incoming request data. |
132 * @param river The river of the request. | 135 * @param river The river of the request. |
257 root.appendChild(gaugeEl); | 260 root.appendChild(gaugeEl); |
258 } | 261 } |
259 | 262 |
260 | 263 |
261 /** Checks i a main value has an official associated, */ | 264 /** Checks i a main value has an official associated, */ |
262 protected static boolean hasOfficialLine(NamedMainValue nmv, Integer riverId) { | 265 protected static boolean hasOfficialLine( |
266 NamedMainValue nmv, | |
267 Integer riverId | |
268 ) { | |
263 for (OfficialLine ol: nmv.getOfficialLines()) { | 269 for (OfficialLine ol: nmv.getOfficialLines()) { |
264 if (ol.getWstColumn().getWst().getRiver().getId().equals(riverId)) { | 270 if ( |
271 ol.getWstColumn().getWst().getRiver().getId().equals(riverId) | |
272 ) { | |
265 return true; | 273 return true; |
266 } | 274 } |
267 } | 275 } |
268 return false; | 276 return false; |
269 } | 277 } |
285 ArtifactNamespaceContext.NAMESPACE_PREFIX); | 293 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
286 | 294 |
287 Element list = cr.create("mainvalues"); | 295 Element list = cr.create("mainvalues"); |
288 | 296 |
289 for (MainValue mainValue: mainValues) { | 297 for (MainValue mainValue: mainValues) { |
290 Element newEl = buildMainValueElement(doc, mainValue, riverId, context); | 298 Element newEl = buildMainValueElement( |
299 doc, mainValue, riverId, context); | |
291 | 300 |
292 if (newEl != null) { | 301 if (newEl != null) { |
293 list.appendChild(newEl); | 302 list.appendChild(newEl); |
294 } | 303 } |
295 } | 304 } |
328 cr.addAttr(el, "name", namedMainValue.getName()); | 337 cr.addAttr(el, "name", namedMainValue.getName()); |
329 cr.addAttr(el, "type", mainValueType.getName()); | 338 cr.addAttr(el, "type", mainValueType.getName()); |
330 if (mainValue.getTimeInterval() != null) { | 339 if (mainValue.getTimeInterval() != null) { |
331 if (mainValue.getTimeInterval().getStartTime() != null) { | 340 if (mainValue.getTimeInterval().getStartTime() != null) { |
332 cr.addAttr(el, "starttime", | 341 cr.addAttr(el, "starttime", |
333 Long.toString(mainValue.getTimeInterval().getStartTime().getTime())); | 342 Long.toString( |
343 mainValue.getTimeInterval().getStartTime().getTime())); | |
334 } | 344 } |
335 if (mainValue.getTimeInterval().getStopTime() != null) { | 345 if (mainValue.getTimeInterval().getStopTime() != null) { |
336 cr.addAttr(el, "stoptime", | 346 cr.addAttr(el, "stoptime", |
337 Long.toString(mainValue.getTimeInterval().getStopTime().getTime())); | 347 Long.toString( |
348 mainValue.getTimeInterval().getStopTime().getTime())); | |
338 } | 349 } |
339 } | 350 } |
340 | 351 |
341 if (hasOfficialLine(namedMainValue, riverId)) { | 352 if (hasOfficialLine(namedMainValue, riverId)) { |
342 cr.addAttr(el, "official", "true"); | 353 cr.addAttr(el, "official", "true"); |