# HG changeset patch # User Sascha L. Teichmann # Date 1347009032 0 # Node ID 421d1b0576b8f6660eae9f6647f40432ed620d04 # Parent 3e1149adc8b92e9c1e62da9e721b35f716230bda Removed deprecated method. flys-artifacts/trunk@5370 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 3e1149adc8b9 -r 421d1b0576b8 flys-artifacts/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/flys/artifacts/model/MainValuesFactory.java: diff -r 3e1149adc8b9 -r 421d1b0576b8 flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.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]; diff -r 3e1149adc8b9 -r 421d1b0576b8 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesFactory.java --- 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 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 :