Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java @ 1157:a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
flys-artifacts/trunk@2689 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 09 Sep 2011 15:03:00 +0000 |
parents | 62ad0a753b68 |
children | fbe18ad4caff |
line wrap: on
line source
package de.intevation.flys.artifacts.states; import java.util.List; import org.apache.log4j.Logger; import de.intevation.artifacts.CallContext; import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.WINFOArtifact; import de.intevation.flys.artifacts.math.WKmsOperation; import de.intevation.flys.artifacts.model.DurationCurveFacet; import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.flys.artifacts.model.WKms; import de.intevation.flys.artifacts.model.WQKms; import de.intevation.flys.artifacts.model.WQDay; import de.intevation.flys.artifacts.model.DataFacet; import de.intevation.flys.artifacts.model.ReportFacet; import de.intevation.flys.artifacts.model.CalculationResult; import de.intevation.flys.artifacts.resources.Resources; import de.intevation.flys.utils.FLYSUtils; public class WDifferencesState extends DefaultState implements FacetTypes { /** The logger that is used in this state. */ private static Logger logger = Logger.getLogger(WDifferencesState.class); public WDifferencesState() { } /** Specify to display a datacage_twin_panel. */ @Override protected String getUIProvider() { return "datacage_twin_panel"; } @Override public Object computeAdvance( FLYSArtifact artifact, String hash, CallContext context, List<Facet> facets, Object old ) { WINFOArtifact winfo = (WINFOArtifact)artifact; // Get a data item (uuids) or parameterization of the respective // artifacts. // TODO Fix, choose artifacts/parameterization dynamically. WINFOArtifact flys1 = (WINFOArtifact) FLYSUtils.getArtifact( //"a110a16d-d155-4115-ab0d-c4c61101c9cb", //Collection "a0ec533f-b05b-4dcd-9db3-7850686f90a2", context); WINFOArtifact flys2 = (WINFOArtifact) FLYSUtils.getArtifact( //"8ebb696d-771a-4540-bd18-15e19744a6e2", //Collection "ce5a2c4e-3f9c-4c4d-a35c-109dd8670992", context); if (flys1 == null) { logger.warn("One of the artifacts (1) for diff calculation could not be loaded"); } if (flys2 == null) { logger.warn("One of the artifacts (2) for diff calculation could not be loaded"); } WKms wkms = null; String facetName = "diff ()"; if (flys1 != null && flys2 != null) { // TODO also check size. // TODO also need index of wqkms. WQKms[] minuend = (WQKms[]) flys1.getWaterlevelData().getData(); WQKms[] subtrahend = (WQKms[]) flys2.getWaterlevelData().getData(); wkms = WKmsOperation.SUBTRACTION.operate(minuend[0], subtrahend[0]); facetName = "W ("+minuend[0].getName() + ") - W (" + subtrahend[0].getName()+")"; logger.warn("Did a WKMSSubtraction"); } if (facets != null) { // TODO: pass computetype and state id. //, ComputeType.ADVANCE, getID(), hash)); facets.add(new DataFacet(W_DIFFERENCES, facetName)); } else { logger.debug("Not adding facets in WDifferencesState."); } return wkms; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :