Mercurial > dive4elements > river
changeset 3455:1de62ac261f7
Let WaterlevelFacet handle FixationArtifact.
flys-artifacts/trunk@5121 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 25 Jul 2012 09:59:43 +0000 (2012-07-25) |
parents | 98745f308319 |
children | c1fd75bd893a |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java |
diffstat | 2 files changed, 30 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Wed Jul 25 09:53:24 2012 +0000 +++ b/flys-artifacts/ChangeLog Wed Jul 25 09:59:43 2012 +0000 @@ -1,3 +1,8 @@ +2012-07-25 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java: + Handle slightly different access to Fixation-WQKms. + 2012-07-25 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/artifacts/states/fixation/FixationSelect.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java Wed Jul 25 09:53:24 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java Wed Jul 25 09:59:43 2012 +0000 @@ -5,12 +5,16 @@ import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; +import de.intevation.flys.artifacts.FixationArtifact; import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.states.DefaultState.ComputeType; +import de.intevation.flys.artifacts.model.fixings.FixRealizingResult; + import org.apache.log4j.Logger; + /** * Facet of a Waterlevel (WQKms). */ @@ -49,12 +53,31 @@ " /stateId: " + stateId); } - FLYSArtifact winfo = (FLYSArtifact)artifact; + FLYSArtifact winfo = (FLYSArtifact) artifact; CalculationResult res = (CalculationResult) winfo.compute(context, hash, stateId, type, false); - WQKms [] wqkms = (WQKms [])res.getData(); + if (res == null) { + logger.error("WaterlevelFacet.getData: null result"); + return null; + } + + if (winfo == null) { + logger.error("WaterlevelFacet.getData: artifact is null"); + return null; + } + + if (winfo instanceof FixationArtifact) { + FixRealizingResult fr = (FixRealizingResult) res.getData(); + if (fr == null || fr.getWQKms() == null) { + logger.error("WaterlevelFacet.getData: " + + " corrupted FixationArtifact result."); + } + return fr.getWQKms()[index]; + } + + WQKms [] wqkms = (WQKms []) res.getData(); return wqkms[index]; }