Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AreaFacet.java @ 2004:94c4dd5aaf20
Made StaticState a bit more convenient to use.
flys-artifacts/trunk@3446 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 16 Dec 2011 14:11:50 +0000 |
parents | 28a5c163f9cd |
children | 7f99845e9499 |
line wrap: on
line source
package de.intevation.flys.artifacts.model; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; import de.intevation.artifactdatabase.state.DefaultFacet; import de.intevation.artifactdatabase.state.Facet; import de.intevation.artifacts.DataProvider; import de.intevation.flys.artifacts.AreaArtifact; import de.intevation.flys.artifacts.states.DefaultState.ComputeType; import de.intevation.flys.artifacts.states.DefaultState.ComputeType; /** * Trival Facet for areas. */ public class AreaFacet extends DefaultFacet implements FacetTypes { private static Logger logger = Logger.getLogger(AreaFacet.class); /** Trivial constructor, set (maybe localized) description. */ public AreaFacet(int idx, String description) { super(idx, AREA, description); } /** * Gets Cross Section (profile). * @param art artifact to get data from. * @param context ignored */ public Object getData(Artifact art, CallContext context) { logger.debug("Get data for area ding"); // Get information from artifact about which // info to grab from blackboard. // // All compatible facets should provide their data // under the key (Artifact-UUID + Facet-Index). AreaArtifact artifact = (AreaArtifact) art; Object lowerData = null; Object upperData = null; List<DataProvider> providers = context. getDataProvider(artifact.getLowerDPKey()); if (providers.size() < 1) { logger.warn("No 'lower' given for area"); } else { lowerData = providers.get(0).provideData( artifact.getLowerDPKey(), null, context); } providers = context.getDataProvider(artifact.getUpperDPKey()); if (providers.size() < 1) { logger.warn("No 'upper' given for area"); } else { upperData = providers.get(0).provideData( artifact.getUpperDPKey(), null, context); } if (upperData == null && lowerData == null) { logger.warn("No 'upper' given for area"); return null; } return new Object[] {lowerData, upperData}; } /** Do a deep copy. */ @Override public Facet deepCopy() { AreaFacet copy = new AreaFacet(this.index, this.description); copy.set(this); return copy; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :