changeset 519:97dc9b8ae68a facet-metadata

Introduced facet metadata.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 21 May 2014 11:23:45 +0200
parents 22d66b405b24
children ab13ab6acc5c
files artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultFacet.java artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/Facet.java
diffstat 2 files changed, 47 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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();
     }
 
 
--- 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.

http://dive4elements.wald.intevation.org