changeset 3575:e9c3285f2ee2

Added State for QSector artifact. flys-artifacts/trunk@5190 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 10 Aug 2012 11:33:48 +0000
parents 416288f88763
children 6442f317a0c7
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/QSectorSingleState.java
diffstat 2 files changed, 96 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Aug 10 11:30:28 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Aug 10 11:33:48 2012 +0000
@@ -1,3 +1,8 @@
+2012-08-10	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/QSectorSingleState.java:
+	  New, accidentally omitted single state of a qsector-artifact.
+
 2012-08-10	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* doc/conf/artifacts/fixanalysis.xml: Add qsectors-facet to
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/QSectorSingleState.java	Fri Aug 10 11:33:48 2012 +0000
@@ -0,0 +1,91 @@
+package de.intevation.flys.artifacts.states;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.artifactdatabase.state.Facet;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.QSectorArtifact;
+
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.QSectorFacet;
+
+import de.intevation.flys.artifacts.resources.Resources;
+
+/**
+ * The only state for an QSectorArtifact.
+ */
+public class QSectorSingleState
+extends      DefaultState
+implements   FacetTypes
+{
+    /** Developer-centric description of facet. */
+    public static final String I18N_DESCRIPTION
+        = "facet.qsector";
+
+    /** The logger that is used in this state. */
+    private static final Logger logger =
+        Logger.getLogger(QSectorSingleState.class);
+
+
+    /**
+     * Add QSectorFacets to list of Facets.
+     *
+     * @param artifact Ignored.
+     * @param hash Ignored.
+     * @param meta CallMeta to be used for internationalization.
+     * @param facets List to add QSectorFacet to.
+     *
+     * @return null.
+     */
+    public Object compute(
+        FLYSArtifact artifact,
+        String       hash,
+        CallMeta     meta,
+        List<Facet>  facets
+    ) {
+        logger.debug("QSectorSingleState.compute()");
+        QSectorArtifact points = (QSectorArtifact) artifact;
+
+        QSectorFacet qfacet = new QSectorFacet(
+            0,
+            "qsectors", //FacetTypes
+            "qsectors");
+
+        facets.add(qfacet);
+
+        return null;
+    }
+
+
+    /** Call compute. */
+    @Override
+    public Object computeInit(
+        FLYSArtifact artifact,
+        String       hash,
+        Object       context,
+        CallMeta     meta,
+        List<Facet>  facets
+     ) {
+        return compute(artifact, hash, meta, facets);
+    }
+
+
+    /** Call compute. */
+    @Override
+    public Object computeFeed(
+        FLYSArtifact artifact,
+        String hash,
+        CallContext context,
+        List<Facet> facets,
+        Object old
+    ) {
+        return compute(artifact, hash, context.getMeta(), facets);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org