# HG changeset patch # User Felix Wolfsteller # Date 1316779088 0 # Node ID c2edf0032cf82f0bfe824cb63f10eeb12b3a46fc # Parent 1b5204203e186b84226e32dbb67cb5f112768b7f Squash a bug about wrongly named position attribute ('pos' vs 'art:pos'). flys-artifacts/trunk@2819 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 1b5204203e18 -r c2edf0032cf8 flys-artifacts/ChangeLog --- 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 + + 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 Refactoring, doc. diff -r 1b5204203e18 -r c2edf0032cf8 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ManagedDomFacet.java --- 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)); }