Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java @ 7529:d2867dc7963f
issue1658: Do not store Access in State.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 07 Nov 2013 09:42:19 +0100 |
parents | ea3e78a7f4e4 |
children | 7302d2af815f |
comparison
equal
deleted
inserted
replaced
7528:d828b659a593 | 7529:d2867dc7963f |
---|---|
51 public static final String I18N_FACET_SEDIMENTLOAD_SUSPSAND = "facet.sedimentload.susp_sand"; | 51 public static final String I18N_FACET_SEDIMENTLOAD_SUSPSAND = "facet.sedimentload.susp_sand"; |
52 public static final String I18N_FACET_SEDIMENTLOAD_SUSPSANDBED = "facet.sediemntload.susp_sand_bed"; | 52 public static final String I18N_FACET_SEDIMENTLOAD_SUSPSANDBED = "facet.sediemntload.susp_sand_bed"; |
53 public static final String I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT = "facet.sedimentload.susp_sediment"; | 53 public static final String I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT = "facet.sedimentload.susp_sediment"; |
54 public static final String I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD = "facet.sedimentload.total_load"; | 54 public static final String I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD = "facet.sedimentload.total_load"; |
55 public static final String I18N_FACET_SEDIMENTLOAD_TOTAL = "facet.sedimentload.total"; | 55 public static final String I18N_FACET_SEDIMENTLOAD_TOTAL = "facet.sedimentload.total"; |
56 | |
57 private transient SedimentLoadAccess access; | |
58 | 56 |
59 static { | 57 static { |
60 // Active/deactivate facets. | 58 // Active/deactivate facets. |
61 FacetActivity.Registry.getInstance().register( | 59 FacetActivity.Registry.getInstance().register( |
62 "minfo", | 60 "minfo", |
131 CallContext context, List<Facet> facets, Object old) { | 129 CallContext context, List<Facet> facets, Object old) { |
132 logger.debug("SedimentLoadCalculate.computeAdvance"); | 130 logger.debug("SedimentLoadCalculate.computeAdvance"); |
133 | 131 |
134 List<Facet> newFacets = new ArrayList<Facet>(); | 132 List<Facet> newFacets = new ArrayList<Facet>(); |
135 | 133 |
136 if (access == null) { | 134 SedimentLoadAccess access = new SedimentLoadAccess(artifact); |
137 access = new SedimentLoadAccess(artifact); | |
138 } | |
139 | 135 |
140 CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old | 136 CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old |
141 : new SedimentLoadCalculation().calculate(access); | 137 : new SedimentLoadCalculation().calculate(access); |
142 | 138 |
143 if (facets == null || res == null) { | 139 if (facets == null || res == null) { |
151 return res; | 147 return res; |
152 } | 148 } |
153 | 149 |
154 String type = access.getYearEpoch(); | 150 String type = access.getYearEpoch(); |
155 if (type.equals("year")) { | 151 if (type.equals("year")) { |
156 generateYearFacets(context, newFacets, results, getID(), hash); | 152 generateYearFacets(context, newFacets, results, getID(), hash, access); |
157 } | 153 } |
158 else if (type.equals("epoch")) { | 154 else if (type.equals("epoch")) { |
159 generateEpochFacets(context, newFacets, results, getID(), hash); | 155 generateEpochFacets(context, newFacets, results, getID(), hash, access); |
160 } | 156 } |
161 else if (type.equals("off_epoch")) { | 157 else if (type.equals("off_epoch")) { |
162 generateOffEpochFacets(context, newFacets, results, getID(), hash); | 158 generateOffEpochFacets(context, newFacets, results, getID(), hash, access); |
163 } | 159 } |
164 logger.debug("Created " + newFacets.size() + " new Facets."); | 160 logger.debug("Created " + newFacets.size() + " new Facets."); |
165 | 161 |
166 String river = access.getRiverName(); | 162 String river = access.getRiverName(); |
167 SedimentLoad[] unknown = | 163 SedimentLoad[] unknown = |
197 } | 193 } |
198 | 194 |
199 | 195 |
200 protected void generateYearFacets(CallContext context, | 196 protected void generateYearFacets(CallContext context, |
201 List<Facet> newFacets, | 197 List<Facet> newFacets, |
202 SedimentLoadResult[] results, String stateId, String hash | 198 SedimentLoadResult[] results, |
199 String stateId, | |
200 String hash, | |
201 SedimentLoadAccess access | |
203 ) { | 202 ) { |
204 logger.debug("SedimentLoadCalculate.generateFacets " + access.getUnit()); | 203 logger.debug("SedimentLoadCalculate.generateFacets " + access.getUnit()); |
205 | 204 |
206 CallMeta meta = context.getMeta(); | 205 CallMeta meta = context.getMeta(); |
207 boolean isUnitTA = access.getUnit().startsWith("t"); | 206 boolean isUnitTA = access.getUnit().startsWith("t"); |
328 protected void generateEpochFacets( | 327 protected void generateEpochFacets( |
329 CallContext context, | 328 CallContext context, |
330 List<Facet> newFacets, | 329 List<Facet> newFacets, |
331 SedimentLoadResult[] results, | 330 SedimentLoadResult[] results, |
332 String stateId, | 331 String stateId, |
333 String hash | 332 String hash, |
333 SedimentLoadAccess access | |
334 ) { | 334 ) { |
335 logger.debug("SedimentLoadCalculate.generateEpochFacets "); | 335 logger.debug("SedimentLoadCalculate.generateEpochFacets "); |
336 | 336 |
337 CallMeta meta = context.getMeta(); | 337 CallMeta meta = context.getMeta(); |
338 boolean isUnitTA = access.getUnit().startsWith("t"); | 338 boolean isUnitTA = access.getUnit().startsWith("t"); |
469 protected void generateOffEpochFacets( | 469 protected void generateOffEpochFacets( |
470 CallContext context, | 470 CallContext context, |
471 List<Facet> newFacets, | 471 List<Facet> newFacets, |
472 SedimentLoadResult[] results, | 472 SedimentLoadResult[] results, |
473 String stateId, | 473 String stateId, |
474 String hash | 474 String hash, |
475 SedimentLoadAccess access | |
475 ) { | 476 ) { |
476 logger.debug("SedimentLoadCalculate.generateOffEpochFacets"); | 477 logger.debug("SedimentLoadCalculate.generateOffEpochFacets"); |
477 | 478 |
478 CallMeta meta = context.getMeta(); | 479 CallMeta meta = context.getMeta(); |
479 boolean isUnitTA = access.getUnit().startsWith("t"); | 480 boolean isUnitTA = access.getUnit().startsWith("t"); |