Mercurial > dive4elements > river
changeset 6944:602dac32a996
issue957: Better name for flowvelocity measured values facets.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 29 Aug 2013 16:33:43 +0200 |
parents | 61128e4b6f46 |
children | 735346b3e438 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/FlowVelocityMeasurementArtifact.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/FlowVelocityMeasurementFactory.java |
diffstat | 2 files changed, 26 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/FlowVelocityMeasurementArtifact.java Thu Aug 29 12:15:28 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/FlowVelocityMeasurementArtifact.java Thu Aug 29 16:33:43 2013 +0200 @@ -8,6 +8,8 @@ package org.dive4elements.river.artifacts; +import java.text.DateFormat; + import java.util.ArrayList; import java.util.List; @@ -29,6 +31,8 @@ import org.dive4elements.river.artifacts.model.FacetTypes; +import org.dive4elements.river.utils.Formatter; + /** Artefact to access flow velocity measurements. */ public class FlowVelocityMeasurementArtifact @@ -111,14 +115,21 @@ List<Facet> fs = new ArrayList<Facet>(); String code = getDatacageIDValue(data); + DateFormat dateFormatter = Formatter.getDateFormatter( + callMeta, "dd.MM.yyy HH:mm"); if (code != null) { // parse code, interact with factory, add real facets. // store relevant parts of code as data. - // TODO i18n/Name for facet: Include date with dateformatter. - String name = - FlowVelocityMeasurementFactory.getFlowVelocityMeasurement( - Integer.parseInt(code)).getDescription(); + FlowVelocityMeasurementValue.FastFlowVelocityMeasurementValue + flowVelocityMeasurement = + FlowVelocityMeasurementFactory.getFlowVelocityMeasurement( + Integer.parseInt(code)); + String name = flowVelocityMeasurement.getDescription(); + logger.debug ("datetime " + flowVelocityMeasurement.getDatetime()); + name += " - " + dateFormatter.format( + flowVelocityMeasurement.getDatetime()); + Facet facet = new FlowVelocityMeasurementFacet( FLOW_VELOCITY_MEASUREMENT, name);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/FlowVelocityMeasurementFactory.java Thu Aug 29 12:15:28 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/FlowVelocityMeasurementFactory.java Thu Aug 29 16:33:43 2013 +0200 @@ -8,12 +8,15 @@ package org.dive4elements.river.artifacts.model.minfo; +import java.util.Date; import java.util.List; import org.apache.log4j.Logger; import org.hibernate.SQLQuery; import org.hibernate.Session; +import org.hibernate.type.StandardBasicTypes; + import org.dive4elements.river.model.FlowVelocityMeasurementValue; import org.dive4elements.river.backend.SessionHolder; @@ -40,7 +43,13 @@ log.debug("FlowVelocityMeasurementFactory.getFlowVelocityMeasurementValue"); Session session = SessionHolder.HOLDER.get(); SQLQuery sqlQuery = null; - sqlQuery = session.createSQLQuery(SQL_SELECT_ONE); + sqlQuery = session.createSQLQuery(SQL_SELECT_ONE) + .addScalar("station", StandardBasicTypes.DOUBLE) + .addScalar("datetime", StandardBasicTypes.DATE) + .addScalar("w", StandardBasicTypes.DOUBLE) + .addScalar("q", StandardBasicTypes.DOUBLE) + .addScalar("v", StandardBasicTypes.DOUBLE) + .addScalar("description", StandardBasicTypes.STRING); sqlQuery.setParameter("id", id); List<Object []> results = sqlQuery.list(); @@ -53,7 +62,7 @@ Double.parseDouble(row[0].toString()), Double.parseDouble(row[2].toString()), Double.valueOf(row[3].toString()), - Double.valueOf(row[4].toString()), null, row[5].toString()); + Double.valueOf(row[4].toString()), (Date) row[1], row[5].toString()); } return null; }