@Override public Set<DataSchemaNode> getChildNodes() { final Set<DataSchemaNode> result = new LinkedHashSet<>(); for (Module module : getModules()) { result.addAll(module.getChildNodes()); } return Collections.unmodifiableSet(result); }
@Override public Set<DataSchemaNode> getDataDefinitions() { final Set<DataSchemaNode> dataDefs = new HashSet<>(); for (Module m : getModules()) { dataDefs.addAll(m.getChildNodes()); } return dataDefs; }
@Override public Set<DataSchemaNode> getChildNodes() { final Set<DataSchemaNode> result = new LinkedHashSet<>(); for (Module module : getModules()) { result.addAll(module.getChildNodes()); } return Collections.unmodifiableSet(result); }
@Override public Set<DataSchemaNode> getDataDefinitions() { final Set<DataSchemaNode> dataDefs = new HashSet<>(); for (Module m : getModules()) { dataDefs.addAll(m.getChildNodes()); } return dataDefs; }
private void processContainersAndLists(final Module module, final JSONObject models, final SchemaContext schemaContext) throws IOException, JSONException { String moduleName = module.getName(); for (DataSchemaNode childNode : module.getChildNodes()) { // For every container and list in the module if (childNode instanceof ContainerSchemaNode || childNode instanceof ListSchemaNode) { processDataNodeContainer((DataNodeContainer) childNode, moduleName, models, true, schemaContext); processDataNodeContainer((DataNodeContainer) childNode, moduleName, models, false, schemaContext); } } }
/** * Returns module's child data node of given name space and name * @param module module * @param nameSpace name space * @param name name * @return child data node schema * @throws DocumentedException if child with given name is not present */ private DataSchemaNode getRootDataSchemaNode(Module module, URI nameSpace, String name) throws DocumentedException { final Collection<DataSchemaNode> childNodes = module.getChildNodes(); for (DataSchemaNode childNode : childNodes) { final QName qName = childNode.getQName(); if (qName.getNamespace().equals(nameSpace) && qName.getLocalName().equals(name)) { return childNode; } } throw new DocumentedException("Unable to find node with namespace: " + nameSpace + "in schema context: " + schemaContext.getCurrentContext().toString(), DocumentedException.ErrorType.application, DocumentedException.ErrorTag.unknown_namespace, DocumentedException.ErrorSeverity.error); }
private void moduleToGenTypes(final Module m, final SchemaContext context) { genCtx.put(m, new ModuleContext()); allTypeDefinitionsToGenTypes(m); groupingsToGenTypes(m, m.getGroupings()); rpcMethodsToGenType(m); allIdentitiesToGenTypes(m, context); notificationsToGenType(m); if (!m.getChildNodes().isEmpty()) { final GeneratedTypeBuilder moduleType = moduleToDataType(m); genCtx.get(m).addModuleNode(moduleType); final String basePackageName = BindingMapping.getRootPackageName(m.getQNameModule()); resolveDataSchemaNodes(m, basePackageName, moduleType, moduleType, m.getChildNodes()); } }
private ModuleContext moduleToGenTypes(final Module module) { final ModuleContext context = new ModuleContext(module); genCtx.put(module.getQNameModule(), context); allTypeDefinitionsToGenTypes(context); groupingsToGenTypes(context, module.getGroupings()); rpcMethodsToGenType(context); allIdentitiesToGenTypes(context); notificationsToGenType(context); if (!module.getChildNodes().isEmpty()) { final GeneratedTypeBuilder moduleType = moduleToDataType(context); context.addModuleNode(moduleType); resolveDataSchemaNodes(context, moduleType, moduleType, module.getChildNodes()); } return context; }
private void addRootPostLink(final Module module, final DataNodeContainer node, final List<Parameter> pathParams, final String resourcePath, final List<Api> apis) { if (containsListOrContainer(module.getChildNodes())) { final Api apiForRootPostUri = new Api(); apiForRootPostUri.setPath(resourcePath); apiForRootPostUri.setOperations(operationPost(module.getName() + MODULE_NAME_SUFFIX, module.getDescription(), module, pathParams, true)); apis.add(apiForRootPostUri); } }
boolean hasAddRootPostLink = false; Collection<DataSchemaNode> dataSchemaNodes = m.getChildNodes(); LOG.debug("child nodes size [{}]", dataSchemaNodes.size()); for (DataSchemaNode node : dataSchemaNodes) {
LeafRefContext buildLeafRefContextTree() throws LeafRefYangSyntaxErrorException { final LeafRefContextBuilder rootBuilder = new LeafRefContextBuilder(schemaContext.getQName(), schemaContext.getPath(), schemaContext); final Set<Module> modules = schemaContext.getModules(); for (final Module module : modules) { for (final DataSchemaNode childNode : module.getChildNodes()) { final LeafRefContext childLeafRefContext = buildLeafRefContextReferencingTree(childNode, module); if (childLeafRefContext.hasReferencingChild() || childLeafRefContext.isReferencing()) { rootBuilder.addReferencingChild(childLeafRefContext, childLeafRefContext.getNodeName()); } } } for (final Module module : modules) { final Collection<DataSchemaNode> childNodes = module.getChildNodes(); for (final DataSchemaNode childNode : childNodes) { final LeafRefContext childLeafRefContext = buildLeafRefContextReferencedByTree(childNode, module); if (childLeafRefContext.hasReferencedChild() || childLeafRefContext.isReferenced()) { rootBuilder.addReferencedByChild(childLeafRefContext, childLeafRefContext.getNodeName()); } } } // FIXME: it might be useful to merge these subtrees (i.e. referencing // and referencedBy subtree) return rootBuilder.build(); }
LeafRefContext buildLeafRefContextTree() throws LeafRefYangSyntaxErrorException { final LeafRefContextBuilder rootBuilder = new LeafRefContextBuilder(schemaContext.getQName(), schemaContext.getPath(), schemaContext); final Set<Module> modules = schemaContext.getModules(); for (final Module module : modules) { for (final DataSchemaNode childNode : module.getChildNodes()) { final LeafRefContext childLeafRefContext = buildLeafRefContextReferencingTree(childNode, module); if (childLeafRefContext.hasReferencingChild() || childLeafRefContext.isReferencing()) { rootBuilder.addReferencingChild(childLeafRefContext, childLeafRefContext.getNodeName()); } } } for (final Module module : modules) { final Collection<DataSchemaNode> childNodes = module.getChildNodes(); for (final DataSchemaNode childNode : childNodes) { final LeafRefContext childLeafRefContext = buildLeafRefContextReferencedByTree(childNode, module); if (childLeafRefContext.hasReferencedChild() || childLeafRefContext.isReferenced()) { rootBuilder.addReferencedByChild(childLeafRefContext, childLeafRefContext.getNodeName()); } } } // FIXME: it might be useful to merge these subtrees (i.e. referencing // and referencedBy subtree) return rootBuilder.build(); }
Collection<DataSchemaNode> _childNodes = module.getChildNodes(); boolean _isNullOrEmpty_1 = IterableExtensions.isNullOrEmpty(_childNodes); boolean _not_1 = (!_isNullOrEmpty_1); _builder.newLine(); _builder.append(" "); Collection<DataSchemaNode> _childNodes_1 = module.getChildNodes(); CharSequence _writeDataSchemaNodes = YangTemplate.writeDataSchemaNodes(_childNodes_1); _builder.append(_writeDataSchemaNodes, " ");