Move DataNormalizationOperation methods 30/83830/3
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 20 Aug 2019 19:20:55 +0000 (21:20 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 20 Aug 2019 22:59:18 +0000 (00:59 +0200)
Some these are not use in the base class, move them closer to their
users.

Change-Id: I09a09946fb0b96ba0d2b291f74613b7f82566f41
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java

index 87e97d460677cb479fb249a6d2b72de5723b15e8..2614caf1ddfb7cbd265fde55da0d00162dc4ce36 100644 (file)
@@ -202,6 +202,24 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
             }
             return potential;
         }
+
+        private static DataNormalizationOperation<?> fromSchemaAndQNameChecked(final DataNodeContainer schema,
+                final QName child) throws DataNormalizationException {
+
+            final Optional<DataSchemaNode> potential = findChildSchemaNode(schema, child);
+            if (!potential.isPresent()) {
+                throw new DataNormalizationException(String.format(
+                        "Supplied QName %s is not valid according to schema %s, potential children nodes: %s", child,
+                        schema,schema.getChildNodes()));
+            }
+
+            final DataSchemaNode result = potential.get();
+            // We try to look up if this node was added by augmentation
+            if (schema instanceof DataSchemaNode && result.isAugmenting()) {
+                return fromAugmentation(schema, (AugmentationTarget) schema, result);
+            }
+            return fromDataSchemaNode(result);
+        }
     }
 
     private static final class ListItemNormalization extends
@@ -317,6 +335,15 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
             super(augmentationIdentifierFrom(augmentation), augmentationProxy(augmentation,schema),null);
         }
 
+        private static DataNodeContainer augmentationProxy(final AugmentationSchemaNode augmentation,
+                final DataNodeContainer schema) {
+            final Set<DataSchemaNode> children = new HashSet<>();
+            for (final DataSchemaNode augNode : augmentation.getChildNodes()) {
+                children.add(schema.getDataChildByName(augNode.getQName()));
+            }
+            return new EffectiveAugmentationSchema(augmentation, children);
+        }
+
         @Override
         public boolean isMixin() {
             return true;
@@ -347,7 +374,6 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
         public NormalizedNode<?, ?> createDefault(final PathArgument currentArg) {
             return Builders.augmentationBuilder().withNodeIdentifier(getIdentifier()).build();
         }
-
     }
 
     private static class UnorderedMapMixinNormalization extends MixinNormalizationOp<NodeIdentifier> {
@@ -498,24 +524,6 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
         return Optional.fromNullable(potential);
     }
 
-    private static DataNormalizationOperation<?> fromSchemaAndQNameChecked(final DataNodeContainer schema,
-            final QName child) throws DataNormalizationException {
-
-        final Optional<DataSchemaNode> potential = findChildSchemaNode(schema, child);
-        if (!potential.isPresent()) {
-            throw new DataNormalizationException(String.format(
-                    "Supplied QName %s is not valid according to schema %s, potential children nodes: %s", child,
-                    schema,schema.getChildNodes()));
-        }
-
-        final DataSchemaNode result = potential.get();
-        // We try to look up if this node was added by augmentation
-        if (schema instanceof DataSchemaNode && result.isAugmenting()) {
-            return fromAugmentation(schema, (AugmentationTarget) schema, result);
-        }
-        return fromDataSchemaNode(result);
-    }
-
     private static ChoiceSchemaNode findChoice(final Iterable<ChoiceSchemaNode> choices, final QName child) {
         ChoiceSchemaNode foundChoice = null;
         choiceLoop: for (final ChoiceSchemaNode choice : choices) {
@@ -537,15 +545,6 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
         return new AugmentationIdentifier(potentialChildren.build());
     }
 
-    private static DataNodeContainer augmentationProxy(final AugmentationSchemaNode augmentation,
-            final DataNodeContainer schema) {
-        final Set<DataSchemaNode> children = new HashSet<>();
-        for (final DataSchemaNode augNode : augmentation.getChildNodes()) {
-            children.add(schema.getDataChildByName(augNode.getQName()));
-        }
-        return new EffectiveAugmentationSchema(augmentation, children);
-    }
-
     /**
      * Returns a DataNormalizationOperation for provided child node.
      *