X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fcode-generator%2Fyang-model-parser-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang%2Fmodel%2Fparser%2Fbuilder%2Fimpl%2FNotificationBuilder.java;h=d2010c6578deb987f946f39e0ec29fe7e3178edc;hb=4ce0f6630bc576b97c8c9a08848aafb6e90a75b0;hp=783b21e04b717ba63695c008ce3545e03e4ec782;hpb=ca85a6f3a39b406ab122fe985ee010a41489f658;p=controller.git diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/NotificationBuilder.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/NotificationBuilder.java index 783b21e04b..d2010c6578 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/NotificationBuilder.java +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/model/parser/builder/impl/NotificationBuilder.java @@ -7,6 +7,7 @@ */ package org.opendaylight.controller.yang.model.parser.builder.impl; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -38,6 +39,7 @@ public class NotificationBuilder extends AbstractChildNodeBuilder implements private final NotificationDefinitionImpl instance; private final Set addedTypedefs = new HashSet(); private final Set addedUsesNodes = new HashSet(); + private final List addedUnknownNodes = new ArrayList(); NotificationBuilder(QName qname) { super(qname); @@ -74,6 +76,13 @@ public class NotificationBuilder extends AbstractChildNodeBuilder implements } instance.setUses(uses); + // UNKNOWN NODES + final List unknownNodes = new ArrayList(); + for(UnknownSchemaNodeBuilder b : addedUnknownNodes) { + unknownNodes.add(b.build()); + } + instance.setUnknownSchemaNodes(unknownNodes); + return instance; } @@ -107,6 +116,11 @@ public class NotificationBuilder extends AbstractChildNodeBuilder implements instance.setStatus(status); } + @Override + public void addUnknownSchemaNode(UnknownSchemaNodeBuilder unknownSchemaNodeBuilder) { + addedUnknownNodes.add(unknownSchemaNodeBuilder); + } + private class NotificationDefinitionImpl implements NotificationDefinition { private final QName qname; @@ -214,6 +228,12 @@ public class NotificationBuilder extends AbstractChildNodeBuilder implements return unknownSchemaNodes; } + private void setUnknownSchemaNodes(List unknownSchemaNodes) { + if(unknownSchemaNodes != null) { + this.unknownSchemaNodes = unknownSchemaNodes; + } + } + @Override public DataSchemaNode getDataChildByName(QName name) { return childNodes.get(name); @@ -237,19 +257,6 @@ public class NotificationBuilder extends AbstractChildNodeBuilder implements int result = 1; result = prime * result + ((qname == null) ? 0 : qname.hashCode()); result = prime * result + ((path == null) ? 0 : path.hashCode()); - result = prime * result - + ((description == null) ? 0 : description.hashCode()); - result = prime * result - + ((reference == null) ? 0 : reference.hashCode()); - result = prime * result - + ((status == null) ? 0 : status.hashCode()); - result = prime * result - + ((childNodes == null) ? 0 : childNodes.hashCode()); - result = prime * result - + ((groupings == null) ? 0 : groupings.hashCode()); - result = prime * result - + ((typeDefinitions == null) ? 0 : typeDefinitions.hashCode()); - result = prime * result + ((uses == null) ? 0 : uses.hashCode()); return result; } @@ -279,55 +286,6 @@ public class NotificationBuilder extends AbstractChildNodeBuilder implements } else if (!path.equals(other.path)) { return false; } - if (description == null) { - if (other.description != null) { - return false; - } - } else if (!description.equals(other.description)) { - return false; - } - if (reference == null) { - if (other.reference != null) { - return false; - } - } else if (!reference.equals(other.reference)) { - return false; - } - if (status == null) { - if (other.status != null) { - return false; - } - } else if (!status.equals(other.status)) { - return false; - } - if (childNodes == null) { - if (other.childNodes != null) { - return false; - } - } else if (!childNodes.equals(other.childNodes)) { - return false; - } - if (groupings == null) { - if (other.groupings != null) { - return false; - } - } else if (!groupings.equals(other.groupings)) { - return false; - } - if (typeDefinitions == null) { - if (other.typeDefinitions != null) { - return false; - } - } else if (!typeDefinitions.equals(other.typeDefinitions)) { - return false; - } - if (uses == null) { - if (other.uses != null) { - return false; - } - } else if (!uses.equals(other.uses)) { - return false; - } return true; } @@ -335,7 +293,7 @@ public class NotificationBuilder extends AbstractChildNodeBuilder implements public String toString() { StringBuilder sb = new StringBuilder( NotificationDefinitionImpl.class.getSimpleName()); - sb.append("[qname=" + qname + "]"); + sb.append("[qname=" + qname + ", path="+ path +"]"); return sb.toString(); } }