/** * Note: the method would be overrided by {@link AbstractAugmentSerializerSource#getChildNodes()}, * since all augmentation schema nodes of same target would be grouped into sort of one node, * so call {@link AbstractAugmentSerializerSource#getChildNodes()} to get all these children * nodes of same target augmentation schemas. */ protected Collection<DataSchemaNode> getChildNodes() { return schemaNode.getChildNodes(); }
static DataSchemaNode findChildSchemaNode(final DataNodeContainer parent, final QName child) { final DataSchemaNode potential = parent.getDataChildByName(child); return potential == null ? findChoice(Iterables.filter(parent.getChildNodes(), ChoiceSchemaNode.class), child) : potential; }
private void emitDataNodeContainer(final DataNodeContainer input) { for (final TypeDefinition<?> typedef : input.getTypeDefinitions()) { emitTypedefNode(typedef); } for (final GroupingDefinition grouping : input.getGroupings()) { emitGrouping(grouping); } for (final DataSchemaNode child : input.getChildNodes()) { emitDataSchemaNode(child); } for (final UsesNode usesNode : input.getUses()) { emitUsesNode(usesNode); } }
public static Optional<ChoiceSchemaNode> findInstantiatedChoice(final DataNodeContainer ctxNode, final QName choiceName) { DataSchemaNode potential = ctxNode.getDataChildByName(choiceName); if (potential instanceof ChoiceSchemaNode) { return Optional.of((ChoiceSchemaNode) potential); } return Optional.empty(); }
Set<UsesNode> usesNodes = container.getUses(); ret.addAll(usesNodes); Set<GroupingDefinition> groupings = container.getGroupings(); for (GroupingDefinition groupingDefinition : groupings) { ret.addAll(getAllUsesNodes(groupingDefinition)); for (DataSchemaNode childNode : container.getChildNodes()) { if (childNode instanceof DataNodeContainer) { ret.addAll(getAllUsesNodes((DataNodeContainer) childNode));
private static void fillRecursively(final List<TypeDefinition<?>> list, final DataNodeContainer container) { final Collection<DataSchemaNode> childNodes = container.getChildNodes(); if (childNodes != null) { for (DataSchemaNode childNode : childNodes) { if (!childNode.isAugmenting()) { if (childNode instanceof ContainerSchemaNode) { fillRecursively(list, (ContainerSchemaNode) childNode); } else if (childNode instanceof ListSchemaNode) { fillRecursively(list, (ListSchemaNode) childNode); } else if (childNode instanceof ChoiceSchemaNode) { for (final CaseSchemaNode caseNode : ((ChoiceSchemaNode) childNode).getCases().values()) { fillRecursively(list, caseNode); } } } } } list.addAll(container.getTypeDefinitions()); final Set<GroupingDefinition> groupings = container.getGroupings(); if (groupings != null) { for (GroupingDefinition grouping : groupings) { fillRecursively(list, grouping); } } } }
final Iterable<DataSchemaNode> childNodes = dataNode.getChildNodes(); if (childNodes != null) { for (DataSchemaNode childNode : childNodes) { this.allTypedefs.addAll(dataNode.getTypeDefinitions()); traverseModule(dataNode); traverseGroupings(dataNode);
final DataSchemaNode child = currentNode.getDataChildByName(currentArg); if (child instanceof DataNodeContainer) { currentNode = (DataNodeContainer) child; } else { for (GroupingDefinition grouping : currentNode.getGroupings()) { if (currentArg.equals(grouping.getQName())) { currentNode = grouping; for (TypeDefinition<?> typedef : currentNode.getTypeDefinitions()) { if (typedef.getQName().equals(currentArg)) { return typedef;
private void traverseGroupings(final DataNodeContainer dataNode) { final Set<GroupingDefinition> groupings = dataNode.getGroupings(); if (groupings != null) { for (GroupingDefinition grouping : groupings) { allGroupings.add(grouping); traverse(grouping); } } }
private static boolean isDependencyContainer(final DataNodeContainer dataNodeContainer) { if(dataNodeContainer.getUses().size() != 1) { return false; } UsesNode onlyUses = dataNodeContainer.getUses().iterator().next(); if(onlyUses.getGroupingPath().getLastComponent().equals(ServiceRef.QNAME) == false) { return false; } return getChildNodeSizeWithoutUses(dataNodeContainer) == 0; }
public static Optional<ChoiceSchemaNode> findInstantiatedChoice(final DataNodeContainer ctxNode, final QName choiceName) { DataSchemaNode potential = ctxNode.getDataChildByName(choiceName); if (potential == null) { potential = ctxNode.getDataChildByName(choiceName.getLocalName()); } if (potential instanceof ChoiceSchemaNode) { return Optional.of((ChoiceSchemaNode) potential); } return Optional.absent(); }
Set<UsesNode> usesNodes = container.getUses(); ret.addAll(usesNodes); Set<GroupingDefinition> groupings = container.getGroupings(); for (GroupingDefinition groupingDefinition : groupings) { ret.addAll(getAllUsesNodes(groupingDefinition)); for (DataSchemaNode childNode : container.getChildNodes()) { if (childNode instanceof DataNodeContainer) { ret.addAll(getAllUsesNodes((DataNodeContainer) childNode));
final Iterable<DataSchemaNode> childNodes = dataNode.getChildNodes(); if (childNodes != null) { for (DataSchemaNode childNode : childNodes) { this.allTypedefs.addAll(dataNode.getTypeDefinitions()); traverseModule(dataNode); traverseGroupings(dataNode);
final DataSchemaNode child = currentNode.getDataChildByName(currentArg); if(child instanceof DataNodeContainer) { currentNode = (DataNodeContainer) child; } else { for( final GroupingDefinition grouping : currentNode.getGroupings()) { if(currentArg.equals(grouping.getQName())) { currentNode = grouping; for(final TypeDefinition<?> typedef : currentNode.getTypeDefinitions()) { if(typedef.getQName().equals(currentArg)) { return typedef;
private void traverseGroupings(final DataNodeContainer dataNode) { final Set<GroupingDefinition> groupings = dataNode.getGroupings(); if (groupings != null) { for (GroupingDefinition grouping : groupings) { allGroupings.add(grouping); traverse(grouping); } } }
private Optional<ActionDefinition> findOrigAction(final DataNodeContainer parent, final ActionDefinition action) { for (UsesNode uses : parent.getUses()) { final GroupingDefinition grp = findUsedGrouping(uses); final Optional<ActionDefinition> found = grp.getActions().stream() .filter(act -> action.getQName().equals(act.getQName())).findFirst(); if (found.isPresent()) { final ActionDefinition result = found.get(); return result.isAddedByUses() ? findOrigAction(grp, result) : found; } } return Optional.empty(); }
@Override public boolean hasNext() { if (container.getChildNodes() != null) { final Collection<DataSchemaNode> childNodes = container.getChildNodes(); if (childNodes != null && !childNodes.isEmpty()) { return childNodes.iterator().hasNext(); } } return false; }
/** * Find child schema node identified by its QName within a provided schema node. * * @param schema schema for parent node - search root * @param qname qname(with or without a revision) of a child node to be found in the parent schema * @return found schema node * @throws java.lang.IllegalStateException if the child was not found in parent schema node */ public static DataSchemaNode findSchemaForChild(final DataNodeContainer schema, final QName qname) { // Try to find child schema node directly, but use a fallback that compares QNames without revisions // and auto-expands choices final DataSchemaNode dataChildByName = schema.getDataChildByName(qname); return dataChildByName == null ? findSchemaForChild(schema, qname, schema.getChildNodes()) : dataChildByName; }
/** * Find choice schema node in parent node by qname of choice. * * @param ctxNode * - parent node * @param choiceName * - qname of choice * @return choice schema node if exists,.empty() otherwise */ public static Optional<ChoiceSchemaNode> findInstantiatedChoice(final DataNodeContainer ctxNode, final QName choiceName) { final DataSchemaNode potential = ctxNode.getDataChildByName(choiceName); if (potential instanceof ChoiceSchemaNode) { return Optional.of((ChoiceSchemaNode) potential); } return Optional.empty(); }
private static GroupingDefinition getGroupingByName(final DataNodeContainer dataNodeContainer, final QName name) { for (final GroupingDefinition grouping : dataNodeContainer.getGroupings()) { if (grouping.getQName().equals(name)) { return grouping; } } return null; }