Iterator<NormalizedNodeContext> iterateChildren(final DataContainerNode<?> data) { return Iterators.transform(((DataContainerNode<?>) node).getValue().iterator(), this::createChild); }
Iterator<NormalizedNodeContext> iterateChildren(final DataContainerNode<?> data) { return Iterators.transform(((DataContainerNode<?>) node).getValue().iterator(), this::createChild); }
private Set<? extends YangInstanceIdentifier.PathArgument> getChildQNames(final Optional<N> actual) { Set<YangInstanceIdentifier.PathArgument> qNames = Sets.newLinkedHashSet(); for (DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> child : actual.get().getValue()) { qNames.add(child.getIdentifier()); } return qNames; }
@Override public Collection<NormalizedNodeUpdate> normalizedUpdates(@Nonnull final YangInstanceIdentifier topLevelIdentifier, @Nonnull final Map.Entry<YangInstanceIdentifier.PathArgument, DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> entry) { // just delegates to lower level checkState(entry.getValue() instanceof DataContainerNode, "Unable to extract children"); final Collection<DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> value = DataContainerNode.class.cast(entry.getValue()).getValue(); return value.stream() .map(DataContainerChild.class::cast) .flatMap(node -> baseRewriteProducer .normalizedUpdates(childYangId(topLevelIdentifier, entry), childMapEntry(node)).stream()) .collect(Collectors.toList()); }
private YangInstanceIdentifier getReadPointFromNode(final YangInstanceIdentifier pathArg, final NormalizedNode nNode) { final YangInstanceIdentifier path = pathArg.node(nNode.getIdentifier()); if (nNode instanceof DataContainerNode) { DataContainerNode node = (DataContainerNode) nNode; if (node.getValue().size() == 1) { return getReadPointFromNode(path, (NormalizedNode) Lists.newArrayList(node.getValue()).get(0)); } } return path; }
private void processDataContainerChild( final DataContainerNode<?> node, final Integer depth, final DataContainerNodeBuilder<? extends YangInstanceIdentifier.PathArgument, ? extends DataContainerNode<?>> newBuilder) { for (DataContainerChild<? extends PathArgument, ?> nodeValue : node.getValue()) { newBuilder.withChild(pruneDataAtDepth(nodeValue, depth - 1)); } }
private void processChildNode(final Set<Object> values, final DataContainerNode<?> parent, final PathArgument arg, final List<QNamePredicate> nodePredicates, final Deque<QNameWithPredicate> path, final YangInstanceIdentifier current) { final Optional<DataContainerChild<?, ?>> child = parent.getChild(arg); if (!child.isPresent()) { // FIXME: YANGTOOLS-901. We have SchemaContext nearby, hence we should be able to cache how to get // to the leaf with with specified QName, without having to iterate through Choices/Augmentations. // That perhaps means we should not have QNameWithPredicates, but NodeIdentifierWithPredicates as // the path specification. for (final DataContainerChild<?, ?> mixin : parent.getValue()) { if (mixin instanceof AugmentationNode || mixin instanceof ChoiceNode) { addValues(values, mixin, nodePredicates, path, current); } } } else { addNextValues(values, child.get(), nodePredicates, path, current); } }
private void processChildNode(final Set<Object> values, final DataContainerNode<?> parent, final PathArgument arg, final List<QNamePredicate> nodePredicates, final Deque<QNameWithPredicate> path, final YangInstanceIdentifier current) { final Optional<DataContainerChild<?, ?>> child = parent.getChild(arg); if (!child.isPresent()) { // FIXME: YANGTOOLS-901. We have SchemaContext nearby, hence we should be able to cache how to get // to the leaf with with specified QName, without having to iterate through Choices/Augmentations. // That perhaps means we should not have QNameWithPredicates, but NodeIdentifierWithPredicates as // the path specification. for (final DataContainerChild<?, ?> mixin : parent.getValue()) { if (mixin instanceof AugmentationNode || mixin instanceof ChoiceNode) { addValues(values, mixin, nodePredicates, path, current); } } } else { addNextValues(values, child.get(), nodePredicates, path, current); } }
private void navigateDataContainerNode(int level, final String parentPath, final DataContainerNode<?> dataContainerNode){ visitor.visitNode(level, parentPath ,dataContainerNode); String newParentPath = parentPath + "/" + dataContainerNode.getIdentifier().toString(); final Iterable<DataContainerChild<? extends YangInstanceIdentifier.PathArgument,?>> value = dataContainerNode.getValue(); for(NormalizedNode<?,?> node : value){ if(node instanceof MixinNode && node instanceof NormalizedNodeContainer){ navigateNormalizedNodeContainerMixin(level, newParentPath, (NormalizedNodeContainer<?, ?, ?>) node); } else { navigateNormalizedNode(level, newParentPath, node); } } }
private void navigateDataContainerNode(int level, final String parentPath, final DataContainerNode<?> dataContainerNode) { visitor.visitNode(level, parentPath, dataContainerNode); String newParentPath = parentPath + "/" + dataContainerNode.getIdentifier().toString(); final Iterable<DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> value = dataContainerNode .getValue(); for (NormalizedNode<?, ?> node : value) { if (node instanceof MixinNode && node instanceof NormalizedNodeContainer) { navigateNormalizedNodeContainerMixin(level, newParentPath, (NormalizedNodeContainer<?, ?, ?>) node); } else { navigateNormalizedNode(level, newParentPath, node); } } }
private void validateDataContainerNodeData(final DataContainerNode<?> node, final LeafRefContext referencedByCtx, final LeafRefContext referencingCtx, final ModificationType modificationType, final YangInstanceIdentifier current) { for (final DataContainerChild<?, ?> child : node.getValue()) { if (child instanceof AugmentationNode) { validateNodeData(child, referencedByCtx, referencingCtx, modificationType, current.node( child.getIdentifier())); return; } validateChildNodeData(child, referencedByCtx, referencingCtx, modificationType, current); } }
private void validateDataContainerNodeData(final DataContainerNode<?> node, final LeafRefContext referencedByCtx, final LeafRefContext referencingCtx, final ModificationType modificationType, final YangInstanceIdentifier current) { for (final DataContainerChild<?, ?> child : node.getValue()) { if (child instanceof AugmentationNode) { validateNodeData(child, referencedByCtx, referencingCtx, modificationType, current.node( child.getIdentifier())); return; } validateChildNodeData(child, referencedByCtx, referencingCtx, modificationType, current); } }
private <L extends DOMDataTreeChangeListener> void initialDataChangeEvent( final YangInstanceIdentifier listenerPath, final L listener) { // FIXME Add support for wildcard listeners final Optional<NormalizedNode<?, ?>> preExistingData = dataTree.takeSnapshot() .readNode(YangInstanceIdentifier.create(stripShardPath(listenerPath))); final DataTreeCandidate initialCandidate; if (preExistingData.isPresent()) { final NormalizedNode<?, ?> data = preExistingData.get(); checkState(data instanceof DataContainerNode, "Expected DataContainer node, but was {}", data.getClass()); // if we are listening on root of some shard we still get // empty normalized node, root is always present if (((DataContainerNode<?>) data).getValue().isEmpty()) { initialCandidate = DataTreeCandidates.newDataTreeCandidate(listenerPath, DataTreeCandidateNodes.empty(data.getIdentifier())); } else { initialCandidate = DataTreeCandidates.fromNormalizedNode(listenerPath, translateRootShardIdentifierToListenerPath(listenerPath, preExistingData.get())); } } else { initialCandidate = DataTreeCandidates.newDataTreeCandidate(listenerPath, DataTreeCandidateNodes.empty(listenerPath.getLastPathArgument())); } listener.onDataTreeChanged(Collections.singleton(initialCandidate)); }
if (treeId.isEmpty()) { checkState(data instanceof DataContainerNode, "Unexpected root node %s", data); if (((DataContainerNode) data).getValue().isEmpty()) {
@Override public void apply(final DOMDataWriteTransaction tx, final YangInstanceIdentifier base, final NodeIdentifierWithPredicates routeKey, final DataContainerNode<?> route, final ContainerNode attributes) { // Build the DataContainer data final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> b = ImmutableNodes.mapEntryBuilder(); b.withNodeIdentifier(routeKey); route.getValue().forEach(b::withChild); // Add attributes final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> cb = Builders.containerBuilder(attributes); cb.withNodeIdentifier(routeAttributesIdentifier()); b.withChild(cb.build()); tx.put(LogicalDatastoreType.OPERATIONAL, base.node(routeKey), b.build()); } }
final Object childNode = ((DataContainerNode) result).getValue().iterator().next(); if (isPost) { iiToDataList.add(result.getIdentifier());