Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QSectorFacet.java @ 4708:45d05402b2a6
Importer: Emit log message when a dry run was run.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 19 Dec 2012 11:40:19 +0100 |
parents | 976ff4b74b96 |
children |
line wrap: on
line source
package de.intevation.flys.artifacts.model; import org.apache.log4j.Logger; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; import de.intevation.flys.artifacts.QSectorArtifact; import de.intevation.artifactdatabase.state.DefaultFacet; import de.intevation.artifactdatabase.state.Facet; /** * Facet to access QSector that where added by user. */ public class QSectorFacet extends DefaultFacet { /** Logger for this class. */ private static final Logger logger = Logger.getLogger(QSectorFacet.class); /** * Trivial Constructor. */ public QSectorFacet() { } /** * Trivial Constructor for a QSectorFacet. * * @param index Database-Index to use. * @param name Name (~type) of Facet. * @param description Description of Facet. */ public QSectorFacet(int index, String name, String description) { super(index, name, description); } /** * Get List of QSector for river from Artifact. * * @param artifact (QSector-)Artifact to query for list of QSector. * @param context Ignored. */ @Override public Object getData(Artifact artifact, CallContext context) { QSectorArtifact qsectorArtifact = (QSectorArtifact) artifact; if (qsectorArtifact == null || context == null || context.getContextValue("currentKm") == null) { logger.error("No artifact, context or currentKm in QSectorFacet"); return null; } double currentKm = ((Double)context.getContextValue("currentKm")).doubleValue(); return qsectorArtifact.getQSectors(currentKm, context); } /** Do a deep copy. */ @Override public Facet deepCopy() { QSectorFacet copy = new QSectorFacet(); copy.set(this); return copy; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :