Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/WQInfoServiceImpl.java Tue Nov 12 17:10:38 2013 +0100 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/WQInfoServiceImpl.java Tue Nov 12 17:11:51 2013 +0100 @@ -10,7 +10,9 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; import java.util.Comparator; +import java.util.Date; import java.util.List; import javax.xml.xpath.XPathConstants; @@ -198,13 +200,32 @@ String official = XMLUtils.xpathString( node, "@official", ArtifactNamespaceContext.INSTANCE); + String starttime = XMLUtils.xpathString( + node, "@starttime", ArtifactNamespaceContext.INSTANCE); + + String stoptime = XMLUtils.xpathString( + node, "@stoptime", ArtifactNamespaceContext.INSTANCE); + if (name != null && type != null) { try { + Calendar cal = Calendar.getInstance(); + java.util.Date start = null; + java.util.Date stop = null; + if (!starttime.equals("")) { + cal.setTimeInMillis(Long.parseLong(starttime)); + start = cal.getTime(); + } + if (!stoptime.equals("")) { + cal.setTimeInMillis(Long.parseLong(stoptime)); + stop = cal.getTime(); + } return new WQInfoObjectImpl( name, type, new Double(value), - official != null && official.equalsIgnoreCase("true")); + official != null && official.equalsIgnoreCase("true"), + start, + stop); } catch (NumberFormatException nfe) { logger.warn(nfe.getLocalizedMessage());