changeset 3647:421d1b0576b8

Removed deprecated method. flys-artifacts/trunk@5370 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 07 Sep 2012 09:10:32 +0000
parents 3e1149adc8b9
children db6bb4c1f41f
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesFactory.java
diffstat 3 files changed, 9 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Sep 06 12:14:15 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Sep 07 09:10:32 2012 +0000
@@ -1,3 +1,11 @@
+2012-09-07	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/MainValuesFactory.java:
+	  Removed the deprecated method.
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java:
+	  Call the new Gauge model method fetchDurationCurveData().
+
 2012-09-06	Björn Ricks	<bjoern.ricks@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/MainValuesFactory.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Thu Sep 06 12:14:15 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Fri Sep 07 09:10:32 2012 +0000
@@ -317,7 +317,7 @@
     {
         logger.info("WINFOArtifact.computeDurationCurveData");
 
-        Object[] obj = MainValuesFactory.getDurationCurveData(gauge);
+        Object[] obj = gauge.fetchDurationCurveData();
 
         int[]    days = (int[]) obj[0];
         double[] qs   = (double[]) obj[1];
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesFactory.java	Thu Sep 06 12:14:15 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesFactory.java	Fri Sep 07 09:10:32 2012 +0000
@@ -30,53 +30,5 @@
 
         return query.list();
     }
-
-
-    /**
-     * Returns an array of [days, qs] necessary to create duration curves.
-     *
-     * @param gauge The selected gauge.
-     * @deprecated
-     *
-     * @return a 2dim array of [days, qs] where days is an int[] and qs is
-     * an double[].
-     */
-    @Deprecated
-    public static Object[] getDurationCurveData(Gauge gauge) {
-        Session session = SessionHolder.HOLDER.get();
-
-        Query query = session.createQuery(
-            "select cast(nmv.name as integer) as days, mv.value as q " +
-            "from MainValue as mv " +
-            "join mv.mainValue as nmv " +
-            "join nmv.type mvt " +
-            "where mvt.name = 'D' and mv.gauge.id = :gauge_id " +
-            "order by days");
-
-        query.setParameter("gauge_id", gauge.getId());
-
-        List<Object> results = query.list();
-        int[]        days    = new int[results.size()];
-        double[]     qs      = new double[results.size()];
-
-        int idx = 0;
-
-        for (Object obj: results) {
-            Object[] arr = (Object[]) obj;
-
-            try {
-                int  day = ((Integer)    arr[0]).intValue();
-                double q = ((BigDecimal) arr[1]).doubleValue();
-
-                days[idx] = day;
-                qs[idx++] = q;
-            }
-            catch (NumberFormatException nfe) {
-                logger.warn(nfe, nfe);
-            }
-        }
-
-        return new Object[] { days, qs };
-    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org