Mercurial > dive4elements > river
changeset 7571:f89ad512f426
issue1020: In WaterlevelSelectState create label more differentiated at
which data comes out of calculation.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 14 Nov 2013 11:56:47 +0100 |
parents | f4c13fbde072 |
children | 85b44b0e6579 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelSelectState.java |
diffstat | 1 files changed, 21 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelSelectState.java Thu Nov 14 11:54:02 2013 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelSelectState.java Thu Nov 14 11:56:47 2013 +0100 @@ -125,20 +125,36 @@ D4EArtifact artifact = RiverUtils.getArtifact(parts[0], cc); - CalculationResult rawData = (CalculationResult) artifact.compute( + Object rawData = artifact.compute( cc, null, - WINFO_WSP_STATE_ID, + //WINFO_WSP_STATE_ID, + artifact.getCurrentStateId(), ComputeType.ADVANCE, false); WQKms[] wqkms; - if (rawData.getData() instanceof ExtremeResult) { - wqkms = ((ExtremeResult) rawData.getData()).getWQKms(); + // TODO issue1020: Fetch cases in which only WKms or + // other weird stuff arrives. + if (rawData instanceof CalculationResult) { + CalculationResult calcResult = (CalculationResult) rawData; + if (calcResult.getData() instanceof ExtremeResult) { + wqkms = ((ExtremeResult) calcResult.getData()).getWQKms(); + } + else { + wqkms = (WQKms[]) calcResult.getData(); + } + } + else if (rawData instanceof WQKms) { + wqkms = new WQKms[] {(WQKms) rawData}; + } + else if (rawData instanceof WQKms[]) { + wqkms = (WQKms[]) rawData; } else { - wqkms = (WQKms[]) rawData.getData(); + logger.error("Do not know how to handle " + rawData.getClass()); + wqkms = null; } int idx = -1;