X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager-facade-xml%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Ffacade%2Fxml%2Fmapping%2Fattributes%2Ffromxml%2FSimpleIdentityRefAttributeReadingStrategy.java;h=c64731e26f7e1866714a3c6814dd600a0a5985aa;hp=35af46c5f3f119c09c9d13a2224b3cee82143bf8;hb=d266f4384d4850af9049d7cddd2bbac8f75ba61e;hpb=b197d75e803beac663033287d769dce62c108490 diff --git a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleIdentityRefAttributeReadingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleIdentityRefAttributeReadingStrategy.java index 35af46c5f3..c64731e26f 100644 --- a/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleIdentityRefAttributeReadingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/fromxml/SimpleIdentityRefAttributeReadingStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2015, 2017 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -19,13 +19,13 @@ import org.opendaylight.controller.config.util.xml.DocumentedException; import org.opendaylight.controller.config.util.xml.XmlElement; import org.opendaylight.yangtools.yang.common.QName; - public class SimpleIdentityRefAttributeReadingStrategy extends SimpleAttributeReadingStrategy { private final String key; private final Map> identityMap; - public SimpleIdentityRefAttributeReadingStrategy(final String nullableDefault, final String key, final Map> identityMap) { + public SimpleIdentityRefAttributeReadingStrategy(final String nullableDefault, final String key, + final Map> identityMap) { super(nullableDefault); this.key = key; this.identityMap = identityMap; @@ -38,22 +38,25 @@ public class SimpleIdentityRefAttributeReadingStrategy extends SimpleAttributeRe final String namespace; final String localName; - if(namespaceOfTextContent.getKey().isEmpty()) { + if (namespaceOfTextContent.getKey().isEmpty()) { localName = content; namespace = xmlElement.getNamespace(); } else { String prefix = namespaceOfTextContent.getKey() + ":"; - Preconditions.checkArgument(content.startsWith(prefix), "Identity ref should be prefixed with \"%s\"", prefix); + Preconditions.checkArgument(content.startsWith(prefix), "Identity ref should be prefixed with \"%s\"", + prefix); localName = content.substring(prefix.length()); namespace = namespaceOfTextContent.getValue(); } Date revision = null; Map revisions = identityMap.get(namespace); - if(revisions.keySet().size() > 1) { + if (revisions.keySet().size() > 1) { for (Map.Entry 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", + 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, revisionToIdentityEntry.getKey()); revision = revisionToIdentityEntry.getKey(); } @@ -66,7 +69,7 @@ public class SimpleIdentityRefAttributeReadingStrategy extends SimpleAttributeRe @Override protected Object postprocessParsedValue(final String textContent) { - HashMap map = Maps.newHashMap(); + HashMap map = Maps.newHashMap(); map.put(key, textContent); return map; }