Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadDataCalculate.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | 4b2b7593815c |
children | 5e38e2924c07 |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
34 implements FacetTypes | 34 implements FacetTypes |
35 { | 35 { |
36 | 36 |
37 private static final long serialVersionUID = 1L; | 37 private static final long serialVersionUID = 1L; |
38 | 38 |
39 private static final Logger logger = Logger | 39 private static final Logger log = Logger |
40 .getLogger(SedimentLoadDataCalculate.class); | 40 .getLogger(SedimentLoadDataCalculate.class); |
41 | 41 |
42 public static final String I18N_FACET_SEDIMENTLOAD_COARSE = "facet.sedimentload.coarse"; | 42 public static final String I18N_FACET_SEDIMENTLOAD_COARSE = "facet.sedimentload.coarse"; |
43 public static final String I18N_FACET_SEDIMENTLOAD_SAND = "facet.sedimentload.sand"; | 43 public static final String I18N_FACET_SEDIMENTLOAD_SAND = "facet.sedimentload.sand"; |
44 public static final String I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE = "facet.sedimentload.fine_middle"; | 44 public static final String I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE = "facet.sedimentload.fine_middle"; |
73 } | 73 } |
74 | 74 |
75 @Override | 75 @Override |
76 public Object computeAdvance(D4EArtifact artifact, String hash, | 76 public Object computeAdvance(D4EArtifact artifact, String hash, |
77 CallContext context, List<Facet> facets, Object old) { | 77 CallContext context, List<Facet> facets, Object old) { |
78 logger.debug("SedimentLoadDataCalculate.computeAdvance"); | 78 log.debug("SedimentLoadDataCalculate.computeAdvance"); |
79 | 79 |
80 SedimentLoadAccess access = new SedimentLoadAccess(artifact); | 80 SedimentLoadAccess access = new SedimentLoadAccess(artifact); |
81 | 81 |
82 CalculationResult res = old instanceof CalculationResult | 82 CalculationResult res = old instanceof CalculationResult |
83 ? (CalculationResult) old | 83 ? (CalculationResult) old |
84 : new SedimentLoadDataCalculation().calculate(access); | 84 : new SedimentLoadDataCalculation().calculate(access); |
85 | 85 |
86 | 86 |
87 if (res == null) { | 87 if (res == null) { |
88 logger.error ("No calculation result."); | 88 log.error ("No calculation result."); |
89 } | 89 } |
90 | 90 |
91 if (facets == null) { | 91 if (facets == null) { |
92 /* No need to create facets as they already exist in this case. */ | 92 /* No need to create facets as they already exist in this case. */ |
93 return res; | 93 return res; |
95 | 95 |
96 Calculation report = res.getReport(); | 96 Calculation report = res.getReport(); |
97 | 97 |
98 if (report != null && report.hasProblems()) { | 98 if (report != null && report.hasProblems()) { |
99 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id)); | 99 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id)); |
100 logger.warn ("Problems : " + report.problemsToString()); | 100 log.warn ("Problems : " + report.problemsToString()); |
101 } | 101 } |
102 | 102 |
103 Object raw = res.getData(); | 103 Object raw = res.getData(); |
104 if (raw == null) { | 104 if (raw == null) { |
105 logger.warn("No result data."); | 105 log.warn("No result data."); |
106 return res; | 106 return res; |
107 } | 107 } |
108 | 108 |
109 SedimentLoadDataResult sdRes; | 109 SedimentLoadDataResult sdRes; |
110 if (raw instanceof SedimentLoadDataResult) { | 110 if (raw instanceof SedimentLoadDataResult) { |
111 sdRes = (SedimentLoadDataResult) raw; | 111 sdRes = (SedimentLoadDataResult) raw; |
112 } else { | 112 } else { |
113 logger.error ("Unknown result"); | 113 log.error ("Unknown result"); |
114 return null; | 114 return null; |
115 } | 115 } |
116 String unit = access.getUnit().replace("_per_","/"); | 116 String unit = access.getUnit().replace("_per_","/"); |
117 | 117 |
118 int i = 0; | 118 int i = 0; |
119 for (Fraction fract: sdRes.getFractions()) { | 119 for (Fraction fract: sdRes.getFractions()) { |
120 logger.debug("Adding facet for fraction '" + fract.getName() + | 120 log.debug("Adding facet for fraction '" + fract.getName() + |
121 "' and period '" + fract.getPeriod() + "'"); | 121 "' and period '" + fract.getPeriod() + "'"); |
122 facets.add(new SedimentLoadDataFacet(i, fract.getName(), | 122 facets.add(new SedimentLoadDataFacet(i, fract.getName(), |
123 unit, fract.getPeriod(), | 123 unit, fract.getPeriod(), |
124 ComputeType.ADVANCE, id, hash, context)); | 124 ComputeType.ADVANCE, id, hash, context)); |
125 i++; | 125 i++; |