Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelSelectState.java @ 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 | d24d29d9efa7 |
children | 003502ea4854 |
comparison
equal
deleted
inserted
replaced
7570:f4c13fbde072 | 7571:f89ad512f426 |
---|---|
123 public static String[] getLabels(CallContext cc, String value) { | 123 public static String[] getLabels(CallContext cc, String value) { |
124 String[] parts = value.split(SPLIT_CHAR); | 124 String[] parts = value.split(SPLIT_CHAR); |
125 | 125 |
126 D4EArtifact artifact = RiverUtils.getArtifact(parts[0], cc); | 126 D4EArtifact artifact = RiverUtils.getArtifact(parts[0], cc); |
127 | 127 |
128 CalculationResult rawData = (CalculationResult) artifact.compute( | 128 Object rawData = artifact.compute( |
129 cc, | 129 cc, |
130 null, | 130 null, |
131 WINFO_WSP_STATE_ID, | 131 //WINFO_WSP_STATE_ID, |
132 artifact.getCurrentStateId(), | |
132 ComputeType.ADVANCE, | 133 ComputeType.ADVANCE, |
133 false); | 134 false); |
134 | 135 |
135 WQKms[] wqkms; | 136 WQKms[] wqkms; |
136 | 137 |
137 if (rawData.getData() instanceof ExtremeResult) { | 138 // TODO issue1020: Fetch cases in which only WKms or |
138 wqkms = ((ExtremeResult) rawData.getData()).getWQKms(); | 139 // other weird stuff arrives. |
140 if (rawData instanceof CalculationResult) { | |
141 CalculationResult calcResult = (CalculationResult) rawData; | |
142 if (calcResult.getData() instanceof ExtremeResult) { | |
143 wqkms = ((ExtremeResult) calcResult.getData()).getWQKms(); | |
144 } | |
145 else { | |
146 wqkms = (WQKms[]) calcResult.getData(); | |
147 } | |
148 } | |
149 else if (rawData instanceof WQKms) { | |
150 wqkms = new WQKms[] {(WQKms) rawData}; | |
151 } | |
152 else if (rawData instanceof WQKms[]) { | |
153 wqkms = (WQKms[]) rawData; | |
139 } | 154 } |
140 else { | 155 else { |
141 wqkms = (WQKms[]) rawData.getData(); | 156 logger.error("Do not know how to handle " + rawData.getClass()); |
157 wqkms = null; | |
142 } | 158 } |
143 | 159 |
144 int idx = -1; | 160 int idx = -1; |
145 try { | 161 try { |
146 idx = Integer.parseInt(parts[2]); | 162 idx = Integer.parseInt(parts[2]); |