Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java @ 3461:1481322efc02
FixA: Removed instanceof hack to fetch the WQKms of the fix realizations.
flys-artifacts/trunk@5129 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 25 Jul 2012 15:07:14 +0000 |
parents | 1de62ac261f7 |
children | 6aea625190da |
comparison
equal
deleted
inserted
replaced
3460:d625f4d06b6a | 3461:1481322efc02 |
---|---|
3 import de.intevation.artifactdatabase.state.Facet; | 3 import de.intevation.artifactdatabase.state.Facet; |
4 | 4 |
5 import de.intevation.artifacts.Artifact; | 5 import de.intevation.artifacts.Artifact; |
6 import de.intevation.artifacts.CallContext; | 6 import de.intevation.artifacts.CallContext; |
7 | 7 |
8 import de.intevation.flys.artifacts.FixationArtifact; | |
9 import de.intevation.flys.artifacts.FLYSArtifact; | 8 import de.intevation.flys.artifacts.FLYSArtifact; |
10 | 9 |
11 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; | 10 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
12 | 11 |
13 import de.intevation.flys.artifacts.model.fixings.FixRealizingResult; | |
14 | |
15 import org.apache.log4j.Logger; | 12 import org.apache.log4j.Logger; |
16 | |
17 | 13 |
18 /** | 14 /** |
19 * Facet of a Waterlevel (WQKms). | 15 * Facet of a Waterlevel (WQKms). |
20 */ | 16 */ |
21 public class WaterlevelFacet extends DataFacet { | 17 public class WaterlevelFacet extends DataFacet { |
31 String name, | 27 String name, |
32 String description, | 28 String description, |
33 ComputeType type, | 29 ComputeType type, |
34 String stateID, | 30 String stateID, |
35 String hash | 31 String hash |
36 | |
37 ) { | 32 ) { |
38 super(index, name, description, type, hash, stateID); | 33 super(index, name, description, type, hash, stateID); |
39 } | 34 } |
40 | 35 |
41 public WaterlevelFacet() { | 36 public WaterlevelFacet() { |
42 } | 37 } |
43 | 38 |
39 protected WQKms [] getWQKms(CalculationResult res) { | |
40 return (WQKms [])res.getData(); | |
41 } | |
44 | 42 |
45 /** | 43 /** |
46 * Get waterlevel data. | 44 * Get waterlevel data. |
47 * @return a WQKms at given index. | 45 * @return a WQKms at given index. |
48 */ | 46 */ |
66 if (winfo == null) { | 64 if (winfo == null) { |
67 logger.error("WaterlevelFacet.getData: artifact is null"); | 65 logger.error("WaterlevelFacet.getData: artifact is null"); |
68 return null; | 66 return null; |
69 } | 67 } |
70 | 68 |
71 if (winfo instanceof FixationArtifact) { | 69 WQKms [] wqkms = getWQKms(res); |
72 FixRealizingResult fr = (FixRealizingResult) res.getData(); | |
73 if (fr == null || fr.getWQKms() == null) { | |
74 logger.error("WaterlevelFacet.getData: " + | |
75 " corrupted FixationArtifact result."); | |
76 } | |
77 return fr.getWQKms()[index]; | |
78 } | |
79 | 70 |
80 WQKms [] wqkms = (WQKms []) res.getData(); | 71 return wqkms != null ? wqkms[index] : null; |
81 | |
82 return wqkms[index]; | |
83 } | 72 } |
84 | 73 |
85 | 74 |
86 /** Copy deeply. */ | 75 /** Copy deeply. */ |
87 @Override | 76 @Override |