Fixed augment schema path resolving.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / main / java / org / opendaylight / controller / yang / model / parser / builder / impl / AugmentationSchemaBuilderImpl.java
index c85955d28948693bc397e4b3d60b560d66f8ca4b..c27bf683fc3b5557c6875b6747e4ff37df784367 100644 (file)
@@ -34,11 +34,13 @@ public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder
     private final AugmentationSchemaImpl instance;
     private final int line;
     private final String augmentTargetStr;
-    private final SchemaPath augmentTarget;
+    private SchemaPath augmentTarget;
+    private SchemaPath finalAugmentTarget;
     private String whenCondition;
     private final Set<DataSchemaNodeBuilder> childNodes = new HashSet<DataSchemaNodeBuilder>();
     private final Set<GroupingBuilder> groupings = new HashSet<GroupingBuilder>();
     private final Set<UsesNodeBuilder> usesNodes = new HashSet<UsesNodeBuilder>();
+    private boolean resolved;
 
     AugmentationSchemaBuilderImpl(final String augmentTargetStr, final int line) {
         this.augmentTargetStr = augmentTargetStr;
@@ -84,6 +86,8 @@ public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder
 
     @Override
     public AugmentationSchema build() {
+        instance.setTargetPath(finalAugmentTarget);
+
         RevisionAwareXPath whenStmt;
         if (whenCondition == null) {
             whenStmt = null;
@@ -116,6 +120,16 @@ public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder
         return instance;
     }
 
+    @Override
+    public boolean isResolved() {
+        return resolved;
+    }
+
+    @Override
+    public void setResolved(boolean resolved) {
+        this.resolved = resolved;
+    }
+
     public String getWhenCondition() {
         return whenCondition;
     }
@@ -150,6 +164,11 @@ public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder
         return augmentTarget;
     }
 
+    @Override
+    public void setTargetPath(SchemaPath path) {
+        this.finalAugmentTarget = path;
+    }
+
     @Override
     public String getTargetPathAsString() {
         return augmentTargetStr;
@@ -223,7 +242,7 @@ public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder
 
 
     private static class AugmentationSchemaImpl implements AugmentationSchema {
-        private final SchemaPath targetPath;
+        private SchemaPath targetPath;
         private RevisionAwareXPath whenCondition;
         private Map<QName, DataSchemaNode> childNodes = Collections.emptyMap();
         private Set<GroupingDefinition> groupings = Collections.emptySet();
@@ -242,6 +261,10 @@ public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder
             return targetPath;
         }
 
+        private void setTargetPath(SchemaPath path) {
+            this.targetPath = path;
+        }
+
         @Override
         public RevisionAwareXPath getWhenCondition() {
             return whenCondition;