comparison artifacts/src/main/java/org/dive4elements/river/artifacts/services/SedimentLoadInfoService.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 ef0ec2498dd0
children 0a5239a1e46e
comparison
equal deleted inserted replaced
8855:d7c005e12af0 8856:5e38e2924c07
28 /** Service delivering info about sediment loads. */ 28 /** Service delivering info about sediment loads. */
29 public class SedimentLoadInfoService 29 public class SedimentLoadInfoService
30 extends D4EService 30 extends D4EService
31 { 31 {
32 /** The log used in this service. */ 32 /** The log used in this service. */
33 private static Logger log = Logger.getLogger(SedimentLoadInfoService.class); 33 private static Logger log = Logger.getLogger(
34 SedimentLoadInfoService.class);
34 35
35 public static final String RIVER_XPATH = "/art:river/text()"; 36 public static final String RIVER_XPATH = "/art:river/text()";
36 public static final String TYPE_XPATH = "/art:river/art:type/text()"; 37 public static final String TYPE_XPATH = "/art:river/art:type/text()";
37 public static final String SQ_TI_XPATH = "/art:river/art:sq_ti_id/text()"; 38 public static final String SQ_TI_XPATH = "/art:river/art:sq_ti_id/text()";
38 public static final String FROM_XPATH = "/art:river/art:location/art:from/text()"; 39 public static final String FROM_XPATH =
39 public static final String TO_XPATH = "/art:river/art:location/art:to/text()"; 40 "/art:river/art:location/art:from/text()";
41 public static final String TO_XPATH =
42 "/art:river/art:location/art:to/text()";
40 43
41 /** 44 /**
42 * Create document with sedimentload infos, 45 * Create document with sedimentload infos,
43 * constrained by contents in data. 46 * constrained by contents in data.
44 */ 47 */
77 return XMLUtils.newDocument(); 80 return XMLUtils.newDocument();
78 } 81 }
79 82
80 /* This call initializes the sedimentloaddata for the river. Might be 83 /* This call initializes the sedimentloaddata for the river. Might be
81 * expensive but has to be done anyway for the calculation later on. */ 84 * expensive but has to be done anyway for the calculation later on. */
82 SedimentLoadData allLoadData = SedimentLoadDataFactory.INSTANCE.getSedimentLoadData( 85 SedimentLoadData allLoadData =
83 river); 86 SedimentLoadDataFactory.INSTANCE.getSedimentLoadData(river);
84 87
85 log.debug("Requested type: " + type + " with sq_ti_id: " + sq_ti_id); 88 log.debug("Requested type: " + type + " with sq_ti_id: " + sq_ti_id);
86 Collection <Load> loads; 89 Collection <Load> loads;
87 if (type.equals("sq_time_intervals")) { 90 if (type.equals("sq_time_intervals")) {
88 loads = allLoadData.findDistinctSQTimeIntervalNonEpochLoadsWithValue(fromD, toD); 91 loads = allLoadData
92 .findDistinctSQTimeIntervalNonEpochLoadsWithValue(fromD, toD);
89 93
90 for (Iterator<Load> it = loads.iterator(); it.hasNext();) { 94 for (Iterator<Load> it = loads.iterator(); it.hasNext();) {
91 /* Skip loads without time interval for this info type. */ 95 /* Skip loads without time interval for this info type. */
92 Load cur = it.next(); 96 Load cur = it.next();
93 if (cur.getSQRelationTimeIntervalId() == null) { 97 if (cur.getSQRelationTimeIntervalId() == null) {
136 "date", 140 "date",
137 String.valueOf(calendar.get(Calendar.YEAR))); 141 String.valueOf(calendar.get(Calendar.YEAR)));
138 } 142 }
139 /* SQ Time interval */ 143 /* SQ Time interval */
140 if (load.getSQRelationTimeIntervalId() != null) { 144 if (load.getSQRelationTimeIntervalId() != null) {
141 ele.setAttribute("sq_ti_id", String.valueOf(load.getSQRelationTimeIntervalId())); 145 ele.setAttribute(
146 "sq_ti_id",
147 String.valueOf(load.getSQRelationTimeIntervalId()));
142 Date start = load.getSQStartTime(); 148 Date start = load.getSQStartTime();
143 Date stop = load.getSQStopTime(); 149 Date stop = load.getSQStopTime();
144 if (start != null && stop != null) { 150 if (start != null && stop != null) {
145 Calendar calendarS = Calendar.getInstance(); 151 Calendar calendarS = Calendar.getInstance();
146 calendarS.setTime(start); 152 calendarS.setTime(start);

http://dive4elements.wald.intevation.org