Merge "Fixed typo in SnapshotBackedWriteTransaction class"
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / mapping / attributes / toxml / SimpleIdentityRefAttributeWritingStrategy.java
index 7c90355051beaee44368a52a3dc0a20f08477140..ed3bb2a9d97b5db100aa73fa1c37588bca76d6ce 100644 (file)
@@ -14,13 +14,13 @@ import org.opendaylight.controller.netconf.confignetconfconnector.util.Util;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
+import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
-import org.w3c.dom.Element;
 
 public class SimpleIdentityRefAttributeWritingStrategy extends SimpleAttributeWritingStrategy {
 
-    private static final char QNAME_SEPARATOR = ':';
     private static final String PREFIX = "prefix";
 
     /**
@@ -41,13 +41,11 @@ public class SimpleIdentityRefAttributeWritingStrategy extends SimpleAttributeWr
     }
 
     @Override
-    protected Element createElement(Document doc, String key, String value) {
+    protected Element createElement(Document doc, String key, String value, Optional<String> namespace) {
         QName qName = QName.create(value);
         String identity = qName.getLocalName();
-        Element element = XmlUtil.createPrefixedTextElement(doc, key, PREFIX, identity);
-
         String identityNamespace = qName.getNamespace().toString();
-        XmlUtil.addPrefixedNamespaceAttr(element, PREFIX, identityNamespace);
+        Element element = XmlUtil.createPrefixedTextElement(doc, XmlUtil.createPrefixedValue(PREFIX, key), PREFIX, identity, Optional.<String>of(identityNamespace));
         return element;
     }
 }