comparison artifacts/src/main/java/org/dive4elements/river/artifacts/FlowVelocityMeasurementArtifact.java @ 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 b77a1e804c0a
children 1843023549df
comparison
equal deleted inserted replaced
6943:61128e4b6f46 6944:602dac32a996
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the 5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
6 * documentation coming with Dive4Elements River for details. 6 * documentation coming with Dive4Elements River for details.
7 */ 7 */
8 8
9 package org.dive4elements.river.artifacts; 9 package org.dive4elements.river.artifacts;
10
11 import java.text.DateFormat;
10 12
11 import java.util.ArrayList; 13 import java.util.ArrayList;
12 import java.util.List; 14 import java.util.List;
13 15
14 import org.apache.log4j.Logger; 16 import org.apache.log4j.Logger;
27 import org.dive4elements.river.artifacts.model.minfo.FlowVelocityMeasurementFactory; 29 import org.dive4elements.river.artifacts.model.minfo.FlowVelocityMeasurementFactory;
28 import org.dive4elements.river.artifacts.states.StaticState; 30 import org.dive4elements.river.artifacts.states.StaticState;
29 31
30 import org.dive4elements.river.artifacts.model.FacetTypes; 32 import org.dive4elements.river.artifacts.model.FacetTypes;
31 33
34 import org.dive4elements.river.utils.Formatter;
35
32 36
33 /** Artefact to access flow velocity measurements. */ 37 /** Artefact to access flow velocity measurements. */
34 public class FlowVelocityMeasurementArtifact 38 public class FlowVelocityMeasurementArtifact
35 extends StaticD4EArtifact 39 extends StaticD4EArtifact
36 implements FacetTypes 40 implements FacetTypes
109 logger.debug(XMLUtils.toString(data)); 113 logger.debug(XMLUtils.toString(data));
110 } 114 }
111 115
112 List<Facet> fs = new ArrayList<Facet>(); 116 List<Facet> fs = new ArrayList<Facet>();
113 String code = getDatacageIDValue(data); 117 String code = getDatacageIDValue(data);
118 DateFormat dateFormatter = Formatter.getDateFormatter(
119 callMeta, "dd.MM.yyy HH:mm");
114 120
115 if (code != null) { 121 if (code != null) {
116 // parse code, interact with factory, add real facets. 122 // parse code, interact with factory, add real facets.
117 // store relevant parts of code as data. 123 // store relevant parts of code as data.
118 // TODO i18n/Name for facet: Include date with dateformatter. 124 FlowVelocityMeasurementValue.FastFlowVelocityMeasurementValue
119 String name = 125 flowVelocityMeasurement =
120 FlowVelocityMeasurementFactory.getFlowVelocityMeasurement( 126 FlowVelocityMeasurementFactory.getFlowVelocityMeasurement(
121 Integer.parseInt(code)).getDescription(); 127 Integer.parseInt(code));
128 String name = flowVelocityMeasurement.getDescription();
129 logger.debug ("datetime " + flowVelocityMeasurement.getDatetime());
130 name += " - " + dateFormatter.format(
131 flowVelocityMeasurement.getDatetime());
132
122 Facet facet = new FlowVelocityMeasurementFacet( 133 Facet facet = new FlowVelocityMeasurementFacet(
123 FLOW_VELOCITY_MEASUREMENT, 134 FLOW_VELOCITY_MEASUREMENT,
124 name); 135 name);
125 fs.add(facet); 136 fs.add(facet);
126 addFacets(state.getID(), fs); 137 addFacets(state.getID(), fs);

http://dive4elements.wald.intevation.org