- protected abstract void verifyWrittenStructure(NormalizedNode<?, ?> writtenValue);
-
- public static class UnkeyedListModificationStrategy extends SchemaAwareApplyOperation {
-
- private final Optional<ModificationApplyOperation> entryStrategy;
-
- protected UnkeyedListModificationStrategy(final ListSchemaNode schema) {
- entryStrategy = Optional.<ModificationApplyOperation> of(new DataNodeContainerModificationStrategy.UnkeyedListItemModificationStrategy(schema));
- }
-
- @Override
- protected TreeNode applyMerge(final ModifiedNode modification, final TreeNode currentMeta,
- final Version version) {
- return applyWrite(modification, Optional.of(currentMeta), version);
- }
-
- @Override
- protected TreeNode applySubtreeChange(final ModifiedNode modification,
- final TreeNode currentMeta, final Version version) {
- throw new UnsupportedOperationException("UnkeyedList does not support subtree change.");
- }
-
- @Override
- protected TreeNode applyWrite(final ModifiedNode modification,
- final Optional<TreeNode> currentMeta, final Version version) {
- return TreeNodeFactory.createTreeNode(modification.getWrittenValue(), version);
- }
-
- @Override
- public Optional<ModificationApplyOperation> getChild(final PathArgument child) {
- if (child instanceof NodeIdentifier) {
- return entryStrategy;
- }
- return Optional.absent();
- }
-
- @Override
- protected void verifyWrittenStructure(final NormalizedNode<?, ?> writtenValue) {
-
- }
-
- @Override
- protected void checkSubtreeModificationApplicable(final InstanceIdentifier path, final NodeModification modification,
- final Optional<TreeNode> current) throws IncorrectDataStructureException {
- throw new IncorrectDataStructureException(path, "Subtree modification is not allowed.");
- }
+ /**
+ * Checks if supplied schema node belong to specified Data Tree type. All nodes belong to the operational tree,
+ * nodes in configuration tree are marked as such.
+ *
+ * @param treeType Tree Type
+ * @param node Schema node
+ * @return
+ */
+ static boolean belongsToTree(final TreeType treeType, final DataSchemaNode node) {
+ return treeType == TreeType.OPERATIONAL || node.isConfiguration();