ModifiedNode instantiation improvement.
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / InMemoryDataTreeModification.java
index e26c32ee5b03bfc01edd2ec64698a66911797bd0..de4bcef79666b6002ede5051ed2064a763838843 100644 (file)
@@ -39,7 +39,7 @@ final class InMemoryDataTreeModification implements DataTreeModification {
     InMemoryDataTreeModification(final InMemoryDataTreeSnapshot snapshot, final RootModificationApplyOperation resolver) {
         this.snapshot = Preconditions.checkNotNull(snapshot);
         this.strategyTree = Preconditions.checkNotNull(resolver).snapshot();
-        this.rootNode = ModifiedNode.createUnmodified(snapshot.getRootNode());
+        this.rootNode = ModifiedNode.createUnmodified(snapshot.getRootNode(), false);
         /*
          * We could allocate version beforehand, since Version contract
          * states two allocated version must be allways different.
@@ -141,8 +141,13 @@ final class InMemoryDataTreeModification implements DataTreeModification {
         ModifiedNode modification = rootNode;
         // We ensure strategy is present.
         ModificationApplyOperation operation = resolveModificationStrategy(path);
+        boolean isOrdered = true;
+        if (operation instanceof SchemaAwareApplyOperation) {
+            isOrdered = ((SchemaAwareApplyOperation) operation).isOrdered();
+        }
+
         for (PathArgument pathArg : path.getPathArguments()) {
-            modification = modification.modifyChild(pathArg);
+            modification = modification.modifyChild(pathArg, isOrdered);
         }
         return OperationWithModification.from(operation, modification);
     }