[PATCH 5 of 7] issue1345: Adjust name of sediment yield/load facets to include fraction name and times

Wald Commits scm-commit at wald.intevation.org
Mon Oct 14 09:58:49 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1381737234 -7200
# Node ID d7b2c14a9693d2398a3e643b9207d2da1163934d
# Parent  2e4ffd35cafaaf4400af0bcd1c886141ea42d085
issue1345: Adjust name of sediment yield/load facets to include fraction name and times.

diff -r 2e4ffd35cafa -r d7b2c14a9693 artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java	Mon Oct 14 09:52:17 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java	Mon Oct 14 09:53:54 2013 +0200
@@ -9,6 +9,8 @@
 package org.dive4elements.river.artifacts;
 
 import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
 import java.util.List;
 
 import org.apache.log4j.Logger;
@@ -29,6 +31,7 @@
 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFacet;
 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFactory;
 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadResult;
+import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.artifacts.states.StaticState;
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
@@ -143,7 +146,16 @@
         String code = getDatacageIDValue(data);
 
         if (code != null) {
-            String name = SedimentLoadFactory.getSedimentYieldDescription(Integer.valueOf(code));
+            String fraction = SedimentLoadFactory.getSedimentYieldFractionName(Integer.valueOf(code));
+            String fractionName = Resources.getMsg(callMeta, fraction, "-");
+            Date[] dates = SedimentLoadFactory.getSedimentYieldTimes(Integer.valueOf(code));
+            Calendar date = Calendar.getInstance();
+            date.setTime(dates[0]);
+            String name = fractionName + " " + date.get(Calendar.YEAR);
+            if (dates[1] != null) {
+                date.setTime(dates[1]);
+                name += " - " + date.get(Calendar.YEAR);
+            }
 
             Facet facet = new SedimentLoadFacet(
                 0,


More information about the Dive4elements-commits mailing list