changeset 488:83ee2c6a53b6

Add boundToOut property to facet and default facet This allows a facet to know for which out it should be relevant
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 31 May 2013 14:59:39 +0200
parents 968f3c2e58aa
children 665613c35cab
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, 36 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultFacet.java	Tue May 28 16:01:44 2013 +0200
+++ b/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultFacet.java	Fri May 31 14:59:39 2013 +0200
@@ -26,6 +26,9 @@
     /** The name of this facet. */
     protected String name;
 
+    /** The out this facet is bound to. */
+    protected String boundToOut;
+
     /** The description of this facet. */
     protected String description;
 
@@ -79,6 +82,24 @@
 
 
     /**
+     * Returns the name of the out this facet is bound to.
+     *
+     * @return the name of the out this facet is bound to.
+     */
+    public String getBoundToOut() {
+        return boundToOut;
+    }
+
+
+    /**
+     * Binds this facet to an out.
+     */
+    public void setBoundToOut(String value) {
+        boundToOut = value;
+    }
+
+
+    /**
      * @return null
      */
     public Object getData(Artifact artifact, CallContext context) {
@@ -133,6 +154,7 @@
         ec.addAttr(facet, "description", description, true);
         ec.addAttr(facet, "name", name, true);
         ec.addAttr(facet, "index", String.valueOf(index), true);
+        ec.addAttr(facet, "boundToOut", boundToOut, true);
 
         return facet;
     }
@@ -143,7 +165,8 @@
         return new StringBuilder("name = '")
             .append(name).append("', index = ")
             .append(index).append(", description = '")
-            .append(description).append("'")
+            .append(description).append("', bound_out = '")
+            .append(boundToOut).append("'")
             .toString();
     }
 
@@ -155,6 +178,7 @@
         index       = other.getIndex();
         name        = other.getName();
         description = other.getDescription();
+        boundToOut  = other.getBoundToOut();
     }
 
 
--- a/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/Facet.java	Tue May 28 16:01:44 2013 +0200
+++ b/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/Facet.java	Fri May 31 14:59:39 2013 +0200
@@ -30,6 +30,17 @@
      */
     String getName();
 
+    /**
+     * Returns the name of the out this facet is bound to.
+     *
+     * @return the name of the out this facet is bound to.
+     */
+    String getBoundToOut();
+
+    /**
+     * Binds this facet to an out.
+     */
+    void setBoundToOut(String value);
 
     /**
      * Returns the description of this facet.

http://dive4elements.wald.intevation.org