# HG changeset patch # User Andre Heinecke # Date 1408533423 -7200 # Node ID 2707c3aa1aa719a635f0ac83f990e098b2f1e700 # Parent cafcd64efbbf8d83a92175adef22e9cb00088a9d (issue1681) Handle different grain fraction kinds diff -r cafcd64efbbf -r 2707c3aa1aa7 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadLSFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadLSFacet.java Wed Aug 20 12:59:01 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadLSFacet.java Wed Aug 20 13:17:03 2014 +0200 @@ -59,7 +59,7 @@ /* Aheinecke we probably need to get the kind and split this up here * in some way */ - private static final String NAME = SEDIMENT_LOAD_TA_STATIC; + private static final String NAME = "sedimentload"; public SedimentLoadLSFacet() { } @@ -120,17 +120,38 @@ return; } logger.debug("Setting up SedimentLoadLSFacet for id: " + id); - logger.debug("GrainFraction: " + theLoad.getGrainFraction().getName()); + if (theLoad.getGrainFraction() != null) { + logger.debug("GrainFraction: " + theLoad.getGrainFraction().getName()); + } logger.debug("Kind: " + theLoad.getKind()); logger.debug("Unit: " + theLoad.getUnit().getName()); - /* TODO: Name is important. We have to add the Grain Fraction and the - * unit in here so that theming is done correctly and unit is correct.*/ + /* Name has the pattern sedimentload.. + * this is partly done for backwards compatibility and theming. + * See issue 1681 for details. */ name = NAME; + + if (theLoad.getUnit().getName().equals("m3/a")) { + /* unit_id is NOT NULL */ + name += ".m3a"; + } else { + name += ".ta"; + } + + String gfName; + if (theLoad.getGrainFraction() != null) { + gfName = theLoad.getGrainFraction().getName(); + } else { + gfName = "unknown"; + } + name += "." + gfName; + + logger.debug("Created facet: " + name); + description = Resources.getMsg( callMeta, - "facet.sedimentload", - "Sedimentload", + "facet.sedimentload.dc." + gfName, + "Error: please add l10n for facet.sedimentload.dc." + gfName, new Object[] { desc }); ((D4EArtifact)artifact).addStringData("load_id", idStr); }