comparison gwt-client/src/main/java/org/dive4elements/river/client/server/WQInfoServiceImpl.java @ 7557:2ca1f3991e17

issue1542: Make WQInfoObjects and server provide start and end date for mainvalues, display in table.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 12 Nov 2013 17:11:51 +0100
parents 19459037b3c7
children 238fc722f87a
comparison
equal deleted inserted replaced
7556:7597bae608b3 7557:2ca1f3991e17
8 8
9 package org.dive4elements.river.client.server; 9 package org.dive4elements.river.client.server;
10 10
11 import java.util.ArrayList; 11 import java.util.ArrayList;
12 import java.util.Arrays; 12 import java.util.Arrays;
13 import java.util.Calendar;
13 import java.util.Comparator; 14 import java.util.Comparator;
15 import java.util.Date;
14 import java.util.List; 16 import java.util.List;
15 17
16 import javax.xml.xpath.XPathConstants; 18 import javax.xml.xpath.XPathConstants;
17 19
18 import org.w3c.dom.Document; 20 import org.w3c.dom.Document;
196 node, "@value", ArtifactNamespaceContext.INSTANCE); 198 node, "@value", ArtifactNamespaceContext.INSTANCE);
197 199
198 String official = XMLUtils.xpathString( 200 String official = XMLUtils.xpathString(
199 node, "@official", ArtifactNamespaceContext.INSTANCE); 201 node, "@official", ArtifactNamespaceContext.INSTANCE);
200 202
203 String starttime = XMLUtils.xpathString(
204 node, "@starttime", ArtifactNamespaceContext.INSTANCE);
205
206 String stoptime = XMLUtils.xpathString(
207 node, "@stoptime", ArtifactNamespaceContext.INSTANCE);
208
201 if (name != null && type != null) { 209 if (name != null && type != null) {
202 try { 210 try {
211 Calendar cal = Calendar.getInstance();
212 java.util.Date start = null;
213 java.util.Date stop = null;
214 if (!starttime.equals("")) {
215 cal.setTimeInMillis(Long.parseLong(starttime));
216 start = cal.getTime();
217 }
218 if (!stoptime.equals("")) {
219 cal.setTimeInMillis(Long.parseLong(stoptime));
220 stop = cal.getTime();
221 }
203 return new WQInfoObjectImpl( 222 return new WQInfoObjectImpl(
204 name, 223 name,
205 type, 224 type,
206 new Double(value), 225 new Double(value),
207 official != null && official.equalsIgnoreCase("true")); 226 official != null && official.equalsIgnoreCase("true"),
227 start,
228 stop);
208 } 229 }
209 catch (NumberFormatException nfe) { 230 catch (NumberFormatException nfe) {
210 logger.warn(nfe.getLocalizedMessage()); 231 logger.warn(nfe.getLocalizedMessage());
211 } 232 }
212 } 233 }

http://dive4elements.wald.intevation.org