comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeInfoService.java @ 4115:0cc2c3d89a9d

#900 Added complete start and end date to the discharge info service and display on in the client side.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 12 Oct 2012 09:27:18 +0200
parents 4bd3d8bbb60c
children 7d4480c0e68e
comparison
equal deleted inserted replaced
4114:ae5119da92cd 4115:0cc2c3d89a9d
41 Document data, 41 Document data,
42 GlobalContext globalContext, 42 GlobalContext globalContext,
43 CallMeta callMeta 43 CallMeta callMeta
44 ) { 44 ) {
45 logger.debug("DischargeInfoService.process"); 45 logger.debug("DischargeInfoService.process");
46 logger.debug(XMLUtils.toString(data));
46 47
47 String gaugeNumber = XMLUtils.xpathString( 48 String gaugeNumber = XMLUtils.xpathString(
48 data, GAUGE_XPATH, ArtifactNamespaceContext.INSTANCE); 49 data, GAUGE_XPATH, ArtifactNamespaceContext.INSTANCE);
49 50
50 if(gaugeNumber == null || 51 if(gaugeNumber == null ||
95 } 96 }
96 97
97 Date startTime = ti.getStartTime(); 98 Date startTime = ti.getStartTime();
98 Date stopTime = ti.getStopTime(); 99 Date stopTime = ti.getStopTime();
99 100
100 // Get the year for start end end date.
101 int startYear;
102 int stopYear;
103 Calendar c = new GregorianCalendar();
104 if (startTime != null) { 101 if (startTime != null) {
105 c.setTime(startTime); 102 discharge.setAttribute("start", String.valueOf(startTime.getTime()));
106 startYear = c.get(Calendar.YEAR);
107 } 103 }
108 else { 104 else {
109 startYear = -1; 105 discharge.setAttribute("start", "-1");
110 } 106 }
107
111 if (stopTime != null) { 108 if (stopTime != null) {
112 c.setTime(stopTime); 109 discharge.setAttribute("end", String.valueOf(stopTime.getTime()));
113 stopYear = c.get(Calendar.YEAR);
114 } 110 }
115 else { 111 else {
116 stopYear = -1; 112 discharge.setAttribute("end", "-1");
117 } 113 }
118
119 discharge.setAttribute("start", String.valueOf(startYear));
120 discharge.setAttribute("end", String.valueOf(stopYear));
121 114
122 all.appendChild(discharge); 115 all.appendChild(discharge);
123 } 116 }
124 result.appendChild(all); 117 result.appendChild(all);
125 return result; 118 return result;

http://dive4elements.wald.intevation.org