comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelFetcher.java @ 9362:392745cccede

Fixed: waterlevels from database should not get the "Bezugspegel" column in the result output.
author gernotbelger
date Wed, 01 Aug 2018 18:40:57 +0200
parents 45f1ad66560e
children 3f49835a00c3
comparison
equal deleted inserted replaced
9361:2aec052d4088 9362:392745cccede
76 } 76 }
77 77
78 private WaterlevelData fetchWaterlevelFromArtifact(final CallContext context, final D4EArtifact d4eArtifact, final int idx, final double from, 78 private WaterlevelData fetchWaterlevelFromArtifact(final CallContext context, final D4EArtifact d4eArtifact, final int idx, final double from,
79 final double to) { 79 final double to) {
80 80
81 if (d4eArtifact instanceof StaticWKmsArtifact) { 81 if (d4eArtifact instanceof StaticWKmsArtifact)
82 return fetchStaticWKmsArtifactWaterlevel((StaticWKmsArtifact) d4eArtifact, idx, from, to); 82 return fetchStaticWKmsArtifactWaterlevel((StaticWKmsArtifact) d4eArtifact, idx, from, to);
83 } 83
84 84 if (d4eArtifact instanceof StaticWQKmsArtifact)
85 if (d4eArtifact instanceof StaticWQKmsArtifact) {
86 return fetchStaticWQKmsArtifactWaterlevel((StaticWQKmsArtifact) d4eArtifact, from, to); 85 return fetchStaticWQKmsArtifactWaterlevel((StaticWQKmsArtifact) d4eArtifact, from, to);
87 }
88 86
89 if (d4eArtifact instanceof WINFOArtifact) 87 if (d4eArtifact instanceof WINFOArtifact)
90 return fetchWINFOArtifactWaterlevel(context, (WINFOArtifact) d4eArtifact, idx, from, to); 88 return fetchWINFOArtifactWaterlevel(context, (WINFOArtifact) d4eArtifact, idx, from, to);
91 89
92 if (d4eArtifact instanceof FixationArtifact) 90 if (d4eArtifact instanceof FixationArtifact)
106 104
107 final WKms wkms = staticWKms.getWKms(idx, from, to); 105 final WKms wkms = staticWKms.getWKms(idx, from, to);
108 106
109 if (wkms != null) { 107 if (wkms != null) {
110 final int year = fetchStaticWKmsYear(staticWKms); 108 final int year = fetchStaticWKmsYear(staticWKms);
111 return new WaterlevelData(wkms, year); 109 return new WaterlevelData(wkms, year, false, false);
112 } 110 }
113 111
114 log.error("No WKms from Static artifact for this range."); 112 log.error("No WKms from Static artifact for this range.");
115 return null; 113 return null;
116 } 114 }
121 119
122 final WQKms wkms = staticWKms.getWQKms(from, to); 120 final WQKms wkms = staticWKms.getWQKms(from, to);
123 121
124 if (wkms != null) { 122 if (wkms != null) {
125 final int year = fetchStaticWKmsYear(staticWKms); 123 final int year = fetchStaticWKmsYear(staticWKms);
126 return new WaterlevelData(wkms, year); 124 return new WaterlevelData(wkms, year, false, false);
127 } 125 }
128 126
129 log.error("No WKms from Static artifact for this range."); 127 log.error("No WKms from Static artifact for this range.");
130 return null; 128 return null;
131 } 129 }
146 return null; 144 return null;
147 } 145 }
148 146
149 // REAMRK: W_INFO results does not know any 'year' 147 // REAMRK: W_INFO results does not know any 'year'
150 final int year = -1; 148 final int year = -1;
151 return new WaterlevelData(wkms[idx], year).filterByRange(from, to); 149 return new WaterlevelData(wkms[idx], year, false, true).filterByRange(from, to);
152 } 150 }
153 151
154 private WaterlevelData fetchFixationArtifactWaterlevel(final CallContext context, final FixationArtifact fixation, final int idx, final double from, 152 private WaterlevelData fetchFixationArtifactWaterlevel(final CallContext context, final FixationArtifact fixation, final int idx, final double from,
155 final double to) { 153 final double to) {
156 154
169 final int year = calculation.determineMeanYear(); 167 final int year = calculation.determineMeanYear();
170 168
171 // REMARK: same logic as in WaterlevelExporter 169 // REMARK: same logic as in WaterlevelExporter
172 final boolean showAllGauges = isFixRealize; 170 final boolean showAllGauges = isFixRealize;
173 171
174 return new WaterlevelData(frR.getWQKms()[idx], year, showAllGauges).filterByRange(from, to); 172 return new WaterlevelData(frR.getWQKms()[idx], year, showAllGauges, true).filterByRange(from, to);
175 } 173 }
176 174
177 /** 175 /**
178 * Fetches the 'year' for a staticXXX-artifact. 176 * Fetches the 'year' for a staticXXX-artifact.
179 * REMARK: actually this should happen inside the staticWKms artifact and eventually in the WKmsFactory, but the code 177 * REMARK: actually this should happen inside the staticWKms artifact and eventually in the WKmsFactory, but the code

http://dive4elements.wald.intevation.org