[Dive4elements-commits] [PATCH 1 of 2] Add boundToOut property to facet and default facet

Wald Commits scm-commit at wald.intevation.org
Fri May 31 15:18:04 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1370005179 -7200
# Node ID 83ee2c6a53b6c7a13ff98565b7289ffaf05389ce
# Parent  968f3c2e58aa0a5b4026a0d3d0e73b9a386cd111
Add boundToOut property to facet and default facet

    This allows a facet to know for which out it should be relevant

diff -r 968f3c2e58aa -r 83ee2c6a53b6 artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/DefaultFacet.java
--- 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();
     }
 
 
diff -r 968f3c2e58aa -r 83ee2c6a53b6 artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/Facet.java
--- 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.


More information about the Dive4elements-commits mailing list