changeset 1636:c2edf0032cf8

Squash a bug about wrongly named position attribute ('pos' vs 'art:pos'). flys-artifacts/trunk@2819 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 23 Sep 2011 11:58:08 +0000
parents 1b5204203e18
children 866c1f37f2bd
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ManagedDomFacet.java
diffstat 2 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Sep 23 07:19:41 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Sep 23 11:58:08 2011 +0000
@@ -1,3 +1,12 @@
+2011-09-23  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+ Squash a bug about wrongly named "art:pos" attribute in ManagedDomFacet (was
+ "pos"). Added documentation from commit message.
+
+	* src/main/java/de/intevation/flys/artifacts/model/ManagedDomFacet.java:
+	  Added documentation (commit message with minor adjustments).
+	  (getPosition, setPosition): Include PREFIX in attribute name.
+
 2011-09-23  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
  Refactoring, doc.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ManagedDomFacet.java	Fri Sep 23 07:19:41 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ManagedDomFacet.java	Fri Sep 23 11:58:08 2011 +0000
@@ -4,9 +4,20 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
+import de.intevation.artifacts.common.utils.XMLUtils;
+
 import de.intevation.artifacts.ArtifactNamespaceContext;
 
 
+/** 
+ * Use an Element (DOM) to store the information about a facet.
+ * The intent of this facet type is to represent a facet
+ * stored in an Collection attribute. Different facets can have different
+ * attributes that we need to parse, but the only thing ManagedFacets need
+ * to do, is to adjust the attributes "active" and "position". So, those
+ * values are set directly on the Element, the other attributes aren't
+ * touched.
+ */
 public class ManagedDomFacet extends ManagedFacet {
 
     protected Element facet;
@@ -64,7 +75,8 @@
     public int getPosition() {
         if (this.position < 0) {
             String position = facet.getAttributeNS(
-                ArtifactNamespaceContext.NAMESPACE_URI, "pos");
+                ArtifactNamespaceContext.NAMESPACE_URI,
+                ArtifactNamespaceContext.NAMESPACE_PREFIX + ":" + "pos");
 
             if (position != null && position.length() > 0) {
                 this.position = Integer.parseInt(position);
@@ -79,9 +91,11 @@
     public void setPosition(int position) {
         this.position = position;
 
+        // TODO Evaluate whether other set/getAttributes also need
+        // to use the NAMESPACE_PREFIX.
         facet.setAttributeNS(
             ArtifactNamespaceContext.NAMESPACE_URI,
-            "pos",
+            ArtifactNamespaceContext.NAMESPACE_PREFIX + ":" + "pos",
             String.valueOf(position));
     }
 

http://dive4elements.wald.intevation.org