import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
import org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.EditConfig;
import org.opendaylight.controller.netconf.util.xml.XmlElement;
import org.opendaylight.yangtools.yang.common.QName;
}
@Override
- protected String readElementContent(XmlElement xmlElement) {
+ protected String readElementContent(XmlElement xmlElement) throws NetconfDocumentedException {
// TODO test
Map.Entry<String, String> namespaceOfTextContent = xmlElement.findNamespaceOfTextContent();
String content = xmlElement.getTextContent();
Date revision = null;
Map<Date, EditConfig.IdentityMapping> revisions = identityMap.get(namespace);
if(revisions.keySet().size() > 1) {
- for (Date date : revisions.keySet()) {
- if(revisions.get(date).containsIdName(localName)) {
+ for (Map.Entry<Date, EditConfig.IdentityMapping> revisionToIdentityEntry : revisions.entrySet()) {
+ if(revisionToIdentityEntry.getValue().containsIdName(localName)) {
Preconditions.checkState(revision == null, "Duplicate identity %s, in namespace %s, with revisions: %s, %s detected. Cannot map attribute",
- localName, namespace, revision, date);
- revision = date;
+ localName, namespace, revision, revisionToIdentityEntry.getKey());
+ revision = revisionToIdentityEntry.getKey();
}
}
- } else
+ } else {
revision = revisions.keySet().iterator().next();
-
+ }
return QName.create(URI.create(namespace), revision, localName).toString();
}