Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadLSFacet.java @ 8109:2707c3aa1aa7
(issue1681) Handle different grain fraction kinds
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 20 Aug 2014 13:17:03 +0200 |
parents | 54d35418141e |
children | 61dae359bb4f |
comparison
equal
deleted
inserted
replaced
8108:cafcd64efbbf | 8109:2707c3aa1aa7 |
---|---|
57 { | 57 { |
58 private static Logger logger = Logger.getLogger(SedimentLoadLSFacet.class); | 58 private static Logger logger = Logger.getLogger(SedimentLoadLSFacet.class); |
59 | 59 |
60 /* Aheinecke we probably need to get the kind and split this up here | 60 /* Aheinecke we probably need to get the kind and split this up here |
61 * in some way */ | 61 * in some way */ |
62 private static final String NAME = SEDIMENT_LOAD_TA_STATIC; | 62 private static final String NAME = "sedimentload"; |
63 | 63 |
64 public SedimentLoadLSFacet() { | 64 public SedimentLoadLSFacet() { |
65 } | 65 } |
66 | 66 |
67 public SedimentLoadLSFacet(int idx, String name, String description, | 67 public SedimentLoadLSFacet(int idx, String name, String description, |
118 if (theLoad == null) { | 118 if (theLoad == null) { |
119 logger.error("No load found for id: " + idStr); | 119 logger.error("No load found for id: " + idStr); |
120 return; | 120 return; |
121 } | 121 } |
122 logger.debug("Setting up SedimentLoadLSFacet for id: " + id); | 122 logger.debug("Setting up SedimentLoadLSFacet for id: " + id); |
123 logger.debug("GrainFraction: " + theLoad.getGrainFraction().getName()); | 123 if (theLoad.getGrainFraction() != null) { |
124 logger.debug("GrainFraction: " + theLoad.getGrainFraction().getName()); | |
125 } | |
124 logger.debug("Kind: " + theLoad.getKind()); | 126 logger.debug("Kind: " + theLoad.getKind()); |
125 logger.debug("Unit: " + theLoad.getUnit().getName()); | 127 logger.debug("Unit: " + theLoad.getUnit().getName()); |
126 | 128 |
127 /* TODO: Name is important. We have to add the Grain Fraction and the | 129 /* Name has the pattern sedimentload.<unit>.<grainfraction_name> |
128 * unit in here so that theming is done correctly and unit is correct.*/ | 130 * this is partly done for backwards compatibility and theming. |
131 * See issue 1681 for details. */ | |
129 name = NAME; | 132 name = NAME; |
133 | |
134 if (theLoad.getUnit().getName().equals("m3/a")) { | |
135 /* unit_id is NOT NULL */ | |
136 name += ".m3a"; | |
137 } else { | |
138 name += ".ta"; | |
139 } | |
140 | |
141 String gfName; | |
142 if (theLoad.getGrainFraction() != null) { | |
143 gfName = theLoad.getGrainFraction().getName(); | |
144 } else { | |
145 gfName = "unknown"; | |
146 } | |
147 name += "." + gfName; | |
148 | |
149 logger.debug("Created facet: " + name); | |
150 | |
130 description = Resources.getMsg( | 151 description = Resources.getMsg( |
131 callMeta, | 152 callMeta, |
132 "facet.sedimentload", | 153 "facet.sedimentload.dc." + gfName, |
133 "Sedimentload", | 154 "Error: please add l10n for facet.sedimentload.dc." + gfName, |
134 new Object[] { desc }); | 155 new Object[] { desc }); |
135 ((D4EArtifact)artifact).addStringData("load_id", idStr); | 156 ((D4EArtifact)artifact).addStringData("load_id", idStr); |
136 } | 157 } |
137 | 158 |
138 | 159 |