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 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 GroupingDefinition getGroupingByName(final DataNodeContainer dataNodeContainer, final QName name) { for (final GroupingDefinition grouping : dataNodeContainer.getGroupings()) { if (grouping.getQName().equals(name)) { return grouping; } } return null; }
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; }
/** * Find child schema node identified by its QName within a provided schema node. This method performs lookup in both * the namespace of groupings and the namespace of all leafs, leaf-lists, lists, containers, choices, rpcs, * actions, notifications, anydatas and anyxmls according to RFC6050/RFC7950 section 6.2.1. * * <p> * This method returns collection of SchemaNodes, because name conflicts can occur between the namespace * of groupings and namespace of data nodes. This method finds and collects all schema nodes with supplied QName * and returns them all as collection of schema nodes. * * @param node * schema node * @param qname * QName * @return collection of child schema nodes * @throws IllegalArgumentException * if the schema node does not allow children */ public static Collection<SchemaNode> findChildSchemaNodesByQName(final SchemaNode node, final QName qname) { final List<SchemaNode> childNodes = new ArrayList<>(); final SchemaNode dataNode = findDataChildSchemaByQName(node, qname); if (dataNode != null) { childNodes.add(dataNode); } if (node instanceof DataNodeContainer) { tryFind(((DataNodeContainer) node).getGroupings(), qname).ifPresent(childNodes::add); } return childNodes.isEmpty() ? ImmutableList.of() : ImmutableList.copyOf(childNodes); }
/** * Find child schema node identified by its QName within a provided schema node. This method performs lookup in both * the namespace of groupings and the namespace of all leafs, leaf-lists, lists, containers, choices, rpcs, * actions, notifications, anydatas and anyxmls according to RFC6050/RFC7950 section 6.2.1. * * <p> * This method returns collection of SchemaNodes, because name conflicts can occur between the namespace * of groupings and namespace of data nodes. This method finds and collects all schema nodes with supplied QName * and returns them all as collection of schema nodes. * * @param node * schema node * @param qname * QName * @return collection of child schema nodes * @throws IllegalArgumentException * if the schema node does not allow children */ public static Collection<SchemaNode> findChildSchemaNodesByQName(final SchemaNode node, final QName qname) { final List<SchemaNode> childNodes = new ArrayList<>(); final SchemaNode dataNode = findDataChildSchemaByQName(node, qname); if (dataNode != null) { childNodes.add(dataNode); } if (node instanceof DataNodeContainer) { tryFind(((DataNodeContainer) node).getGroupings(), qname).ifPresent(childNodes::add); } return childNodes.isEmpty() ? ImmutableList.of() : ImmutableList.copyOf(childNodes); }
Set<GroupingDefinition> groupings = container.getGroupings(); for (GroupingDefinition groupingDefinition : groupings) { ret.addAll(getAllUsesNodes(groupingDefinition));
} else { for (GroupingDefinition grouping : currentNode.getGroupings()) { if (currentArg.equals(grouping.getQName())) { currentNode = grouping;
Set<GroupingDefinition> groupings = container.getGroupings(); for (GroupingDefinition groupingDefinition : groupings) { ret.addAll(getAllUsesNodes(groupingDefinition));
} else { for( final GroupingDefinition grouping : currentNode.getGroupings()) { if(currentArg.equals(grouping.getQName())) { currentNode = grouping;
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); } } } }
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); } }
groupingsToGenTypes(context, containerSchema.getGroupings()); addImplementedInterfaceFromUses(containerSchema, it);
groupingsToGenTypes(module, ((DataNodeContainer) schemaNode).getGroupings()); addImplementedInterfaceFromUses((DataNodeContainer) schemaNode, it);
private GeneratedTypeBuilder processDataSchemaNode(final Module module, final String basePackageName, final GeneratedTypeBuilder childOf, final DataSchemaNode node) { if (node.isAugmenting() || node.isAddedByUses()) { return null; } final String packageName = packageNameForGeneratedType(basePackageName, node.getPath()); final GeneratedTypeBuilder genType = addDefaultInterfaceDefinition(packageName, node, childOf, module); genType.addComment(node.getDescription()); genType.setDescription(createDescription(node, genType.getFullyQualifiedName())); genType.setModuleName(module.getName()); genType.setReference(node.getReference()); genType.setSchemaPath(node.getPath().getPathFromRoot()); if (node instanceof DataNodeContainer) { genCtx.get(module).addChildNodeType(node, genType); groupingsToGenTypes(module, ((DataNodeContainer) node).getGroupings()); processUsesAugments((DataNodeContainer) node, module); } return genType; }
private GeneratedTypeBuilder processDataSchemaNode(final ModuleContext context, final Type baseInterface, final DataSchemaNode node) { if (node.isAugmenting() || node.isAddedByUses()) { return null; } final GeneratedTypeBuilder genType = addDefaultInterfaceDefinition(context, node, baseInterface); annotateDeprecatedIfNecessary(node.getStatus(), genType); final Module module = context.module(); genType.setModuleName(module.getName()); addCodegenInformation(genType, module, node); genType.setSchemaPath(node.getPath()); if (node instanceof DataNodeContainer) { context.addChildNodeType(node, genType); groupingsToGenTypes(context, ((DataNodeContainer) node).getGroupings()); processUsesAugments((DataNodeContainer) node, context); } return genType; }