# HG changeset patch # User Tom Gottfried # Date 1404837195 -7200 # Node ID 0fdd239f4f39294a70821260ae720b9e0f1d77f6 # Parent ab13ab6acc5c381dc5916b406841229a0bdfbeb5# Parent 52c11c3a1f79c50ce5dca17ad3fa018c2ba6f556 Merged default into branch facet-metadata. diff -r 52c11c3a1f79 -r 0fdd239f4f39 artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultFacet.java --- a/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultFacet.java Fri Jun 27 19:28:24 2014 +0200 +++ b/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultFacet.java Tue Jul 08 18:33:15 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 metaData; /** Trivial, empty constructor. */ public DefaultFacet() { + this.metaData = new HashMap(); } @@ -60,6 +65,7 @@ this.index = index; this.name = name; this.description = description; + this.metaData = new HashMap(); } @@ -108,6 +114,32 @@ /** + * Returns the meta data this facet provides. + * + * @param artifact The owner artifact. + * @param context The CallContext. + * + * @return the meta data. + */ + @Override + public Map getMetaData( + Artifact artifact, + CallContext context) + { + return this.metaData; + } + + @Override + public Map getMetaData() { + return this.metaData; + } + + @Override + public void addMetaData(String key, String value) { + this.metaData.put(key, value); + } + + /** * (Do not) provide data. * Override to allow other facets to access your data. * @return always null. @@ -179,6 +211,7 @@ name = other.getName(); description = other.getDescription(); boundToOut = other.getBoundToOut(); + metaData = other.getMetaData(); } diff -r 52c11c3a1f79 -r 0fdd239f4f39 artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/Facet.java --- a/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/Facet.java Fri Jun 27 19:28:24 2014 +0200 +++ b/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/Facet.java Tue Jul 08 18:33:15 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,31 @@ /** + * Returns the meta data this facet provides. + * + * @return the meta data. + */ + Map getMetaData(); + + /** + * Returns the meta data this facet provides. + * + * @param artifact The owner artifact. + * @param context The CallContext. + * + * @return the meta data. + */ + Map getMetaData(Artifact artifact, CallContext context); + + /** + * Add a key value pair to the facets metadata. + * + * @param key The meta data key. + * @param value The meta data value. + */ + void addMetaData(String key, String value); + + /** * Get keys for which this Facet can provide data (for other facets, not * for plot). * @param artifact Artifact that this facet belongs to. @@ -97,5 +123,6 @@ Node toXML(Document doc); Facet deepCopy(); + } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :