[java-opensaml COMMIT] in /trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml: ctx/impl/AttributeValueTypeMar...

noreply at shibboleth.net noreply at shibboleth.net
Wed Jun 6 17:08:17 BST 2012


Author: rdw
Date: Wed Jun  6 17:08:17 2012
New Revision: 3058

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3058&view=rev
Log:
Handle unknown attributes during marshalling/unmarshalling using helper methods.  Including adding missing handler to AttributeValueType unmarshalling.

Modified:
    trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/AttributeValueTypeMarshaller.java
    trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/AttributeValueTypeUnmarshaller.java
    trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/ResourceContentTypeMarshaller.java
    trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/ResourceContentTypeUnmarshaller.java
    trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/policy/impl/AttributeValueTypeMarshaller.java
    trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/policy/impl/AttributeValueTypeUnmarshaller.java

Modified: trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/AttributeValueTypeMarshaller.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/AttributeValueTypeMarshaller.java?rev=3058&r1=3057&r2=3058&view=diff
==============================================================================
--- trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/AttributeValueTypeMarshaller.java (original)
+++ trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/AttributeValueTypeMarshaller.java Wed Jun  6 17:08:17 2012
@@ -17,19 +17,12 @@
 
 package org.opensaml.xacml.ctx.impl;
 
-import java.util.Map.Entry;
-
-import javax.xml.namespace.QName;
-
-import net.shibboleth.utilities.java.support.xml.AttributeSupport;
 import net.shibboleth.utilities.java.support.xml.ElementSupport;
 
 import org.opensaml.core.xml.XMLObject;
-import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
 import org.opensaml.core.xml.io.MarshallingException;
 import org.opensaml.xacml.ctx.AttributeValueType;
 import org.opensaml.xacml.impl.AbstractXACMLObjectMarshaller;
-import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
 
 /** Marshaller for {@link AttributeValueType} objects. */
@@ -44,16 +37,7 @@
     protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
         AttributeValueType attributeValue = (AttributeValueType) xmlObject;
 
-        Attr attribute;
-        for (Entry<QName, String> entry : attributeValue.getUnknownAttributes().entrySet()) {
-            attribute = AttributeSupport.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
-            attribute.setValue(entry.getValue());
-            domElement.setAttributeNodeNS(attribute);
-            if (XMLObjectProviderRegistrySupport.isIDAttribute(entry.getKey())
-                    || attributeValue.getUnknownAttributes().isIDAttribute(entry.getKey())) {
-                attribute.getOwnerElement().setIdAttributeNode(attribute, true);
-            }
-        }
+        marshallUnknownAttributes(attributeValue, domElement);
     }
 
     /** {@inheritDoc} */

Modified: trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/AttributeValueTypeUnmarshaller.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/AttributeValueTypeUnmarshaller.java?rev=3058&r1=3057&r2=3058&view=diff
==============================================================================
--- trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/AttributeValueTypeUnmarshaller.java (original)
+++ trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/AttributeValueTypeUnmarshaller.java Wed Jun  6 17:08:17 2012
@@ -17,10 +17,7 @@
 
 package org.opensaml.xacml.ctx.impl;
 
-import javax.xml.namespace.QName;
-
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
-import net.shibboleth.utilities.java.support.xml.QNameSupport;
 
 import org.opensaml.core.xml.XMLObject;
 import org.opensaml.core.xml.io.UnmarshallingException;
@@ -52,11 +49,7 @@
     protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
         AttributeValueType attributeValue = (AttributeValueType) xmlObject;
 
-        QName attribQName = QNameSupport.getNodeQName(attribute);
-        if (attribute.isId()) {
-            attributeValue.getUnknownAttributes().registerID(attribQName);
-        }
-        attributeValue.getUnknownAttributes().put(attribQName, attribute.getValue());
+        processUnknownAttribute(attributeValue, attribute);
     }
 
     /** {@inheritDoc} */

Modified: trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/ResourceContentTypeMarshaller.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xacml-impl/src/main/java/org/opensaml/xacml/ctx/impl/ResourceContentTypeMarshaller.java?rev=3058&r1=3057&r2=3058&view=diff
==============================================================================

[... 101 lines stripped ...]


More information about the commits mailing list