X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-netconf-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fconfignetconfconnector%2Fmapping%2Fruntime%2FInstanceRuntime.java;h=44227bb4d816042c3aae502a52102da49ce2e534;hp=8c3b35122c2061af455222b70b464b3471ad6fc5;hb=8720a3f3498bbc6fab675431f4200d26641a8ec8;hpb=3ab0ebe1df3e7606cce0a61572f79bf12deb17c0 diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/runtime/InstanceRuntime.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/runtime/InstanceRuntime.java index 8c3b35122c..44227bb4d8 100644 --- a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/runtime/InstanceRuntime.java +++ b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/runtime/InstanceRuntime.java @@ -8,22 +8,19 @@ package org.opendaylight.controller.netconf.confignetconfconnector.mapping.runtime; -import java.util.Hashtable; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import javax.management.ObjectName; - +import com.google.common.base.Optional; +import com.google.common.base.Predicate; +import com.google.common.collect.Collections2; +import com.google.common.collect.Sets; import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.InstanceConfig; import org.opendaylight.controller.netconf.util.xml.XmlUtil; import org.w3c.dom.Document; import org.w3c.dom.Element; -import com.google.common.base.Optional; -import com.google.common.base.Predicate; -import com.google.common.collect.Collections2; -import com.google.common.collect.Sets; +import javax.management.ObjectName; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; public class InstanceRuntime { @@ -48,20 +45,23 @@ public class InstanceRuntime { * root + any number of additional properties */ private Set findChildren(ObjectName innerRootBean, Set childRbeOns) { - final Hashtable wantedProperties = innerRootBean.getKeyPropertyList(); + final Map wantedProperties = innerRootBean.getKeyPropertyList(); return Sets.newHashSet(Collections2.filter(childRbeOns, new Predicate() { @Override public boolean apply(ObjectName on) { - Hashtable localProperties = on.getKeyPropertyList(); + Map localProperties = on.getKeyPropertyList(); for (Entry propertyEntry : wantedProperties.entrySet()) { - if (!localProperties.containsKey(propertyEntry.getKey())) + if (!localProperties.containsKey(propertyEntry.getKey())){ return false; - if (!localProperties.get(propertyEntry.getKey()).equals(propertyEntry.getValue())) + } + if (!localProperties.get(propertyEntry.getKey()).equals(propertyEntry.getValue())){ return false; - if (localProperties.size() <= wantedProperties.size()) + } + if (localProperties.size() <= wantedProperties.size()){ return false; + } } return true; } @@ -77,11 +77,10 @@ public class InstanceRuntime { @Override public boolean apply(ObjectName on) { - if (on.getKeyPropertyList().size() != keyListSize + 1) - return false; - if (!on.getKeyPropertyList().containsKey(string)) + if (on.getKeyPropertyList().size() != keyListSize + 1){ return false; - return true; + } + return on.getKeyPropertyList().containsKey(string); } })); } @@ -92,7 +91,7 @@ public class InstanceRuntime { public Element toXml(ObjectName rootOn, Set childRbeOns, Document document, String instanceIndex, Element parentElement, String namespace) { - Element xml = instanceMapping.toXml(rootOn, null, namespace, document, parentElement); + Element xml = instanceMapping.toXml(rootOn, namespace, document, parentElement); if (instanceIndex != null) { xml.setAttribute(KEY_ATTRIBUTE_KEY, instanceIndex);