changeset 5729:187762f5e905

New FixEvent Facet.New FixEvent Facet.New FixEvent Facet.New FixEvent Facet.New FixEvent Facet.New FixEvent Facet.New FixEvent Facet.New FixEvent Facet.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 16 Apr 2013 12:41:02 +0200
parents c08f691652cf
children 4ce126aa130c
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixEventFacet.java
diffstat 1 files changed, 62 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixEventFacet.java	Tue Apr 16 12:41:02 2013 +0200
@@ -0,0 +1,62 @@
+package de.intevation.flys.artifacts.model.fixings;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.WQKmsFactory;
+import de.intevation.flys.artifacts.access.FixRealizingAccess;
+
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
+
+
+/**
+ * Facet to show W|Q|km Values.
+ */
+public class FixEventFacet
+extends      DataFacet
+implements   FacetTypes {
+
+    /** House logger. */
+    private static Logger logger = Logger.getLogger(FixEventFacet.class);
+
+
+    public FixEventFacet(int index, String name, String description) {
+        super(index, name, description, ComputeType.FEED, null, null);
+    }
+
+
+    /**
+     * Returns the data this facet requires.
+     *
+     * @param artifact the owner artifact.
+     * @param context  the CallContext (ignored).
+     *
+     * @return the data.
+     */
+    @Override
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("FixEventFacet.getData");
+
+        FixRealizingAccess access = new FixRealizingAccess((FLYSArtifact) artifact, context);
+        int wstColID = access.getEvents()[index];
+        return WQKmsFactory.getWQKmsCID(wstColID);
+    }
+
+
+    /**
+     * Create a deep copy of this Facet.
+     * @return a deep copy.
+     */
+    @Override
+    public FixEventFacet deepCopy() {
+        FixEventFacet copy = new FixEventFacet(index, name, description);
+        copy.set(this);
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org