[PATCH] Introduced facet metadata

Wald Commits scm-commit at wald.intevation.org
Wed May 21 11:24:41 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1400664225 -7200
# Branch facet-metadata
# Node ID 97dc9b8ae68afdd1c23a8fe4b8654f0d18153d66
# Parent  22d66b405b248fac25848bbfb2245211dd7fceb7
Introduced facet metadata.

diff -r 22d66b405b24 -r 97dc9b8ae68a artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultFacet.java
--- a/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultFacet.java	Wed Apr 30 15:30:33 2014 +0200
+++ b/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultFacet.java	Wed May 21 11:23:45 2014 +0200
@@ -1,6 +1,8 @@
 package org.dive4elements.artifactdatabase.state;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -32,9 +34,12 @@
     /** The description of this facet. */
     protected String description;
 
+    /** The meta data this facet provides. */
+    protected Map<String, String> metaData;
 
     /** Trivial, empty constructor. */
     public DefaultFacet() {
+        this.metaData = new HashMap<String, String>();
     }
 
 
@@ -60,6 +65,7 @@
         this.index       = index;
         this.name        = name;
         this.description = description;
+        this.metaData    = new HashMap<String, String>();
     }
 
 
@@ -108,6 +114,27 @@
 
 
     /**
+     * Returns the meta data this facet provides.
+     *
+     * @param artifact The owner artifact.
+     * @param context The CallContext.
+     *
+     * @return the meta data.
+     */
+    @Override
+    public Map<String, String> getMetaData(
+        Artifact artifact,
+        CallContext context)
+    {
+        return this.metaData;
+    }
+
+    @Override
+    public Map<String, String> getMetaData() {
+        return this.metaData;
+    }
+
+    /**
      * (Do not) provide data.
      * Override to allow other facets to access your data.
      * @return always null.
@@ -179,6 +206,7 @@
         name        = other.getName();
         description = other.getDescription();
         boundToOut  = other.getBoundToOut();
+        metaData    = other.getMetaData();
     }
 
 
diff -r 22d66b405b24 -r 97dc9b8ae68a artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/Facet.java
--- a/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/Facet.java	Wed Apr 30 15:30:33 2014 +0200
+++ b/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/Facet.java	Wed May 21 11:23:45 2014 +0200
@@ -1,6 +1,7 @@
 package org.dive4elements.artifactdatabase.state;
 
 import java.util.List;
+import java.util.Map;
 
 import java.io.Serializable;
 
@@ -62,6 +63,24 @@
 
 
     /**
+     * Returns the meta data this facet provides.
+     *
+     * @return the meta data.
+     */
+    Map<String, String> getMetaData();
+
+    /**
+     * Returns the meta data this facet provides.
+     *
+     * @param artifact The owner artifact.
+     * @param context The CallContext.
+     *
+     * @return the meta data.
+     */
+    Map<String, String> getMetaData(Artifact artifact, CallContext context);
+
+
+    /**
      * Get keys for which this Facet can provide data (for other facets, not
      * for plot).
      * @param artifact Artifact that this facet belongs to.


More information about the Dive4Elements-commits mailing list