@Override protected QName getQName(ContainerSchemaNode schema) { return schema.getQName(); }
private void containerToGenType(final Module module, final String basePackageName, final GeneratedTypeBuilder parent, final GeneratedTypeBuilder childOf, final ContainerSchemaNode node) { final GeneratedTypeBuilder genType = processDataSchemaNode(module, basePackageName, childOf, node); if (genType != null) { constructGetter(parent, node.getQName().getLocalName(), node.getDescription(), genType); resolveDataSchemaNodes(module, basePackageName, genType, genType, node.getChildNodes()); } }
private void emitContainer(final ContainerSchemaNode child) { super.writer.startContainerNode(child.getQName()); child.getMustConstraints().forEach(this::emitMust); child.getWhenCondition().ifPresent(this::emitWhen); // FIXME: BUG-2444: whenNode //:Optional // FIXME: BUG-2444: *(ifFeatureNode ) emitPresenceNode(child.isPresenceContainer()); emitConfigNode(child.isConfiguration()); emitDocumentedNode(child); emitDataNodeContainer(child); emitUnknownStatementNodes(child.getUnknownSchemaNodes()); emitNotifications(child.getNotifications()); emitActions(child.getActions()); super.writer.endNode(); }
private void emitRefineContainerNodes(final ContainerSchemaNode value) { final ContainerSchemaNode original = getOriginalChecked(value); // emitMustNodes(child.getConstraints().getMustConstraints()); if (Objects.deepEquals(original.isPresenceContainer(), value.isPresenceContainer())) { emitPresenceNode(value.isPresenceContainer()); } if (Objects.deepEquals(original.isConfiguration(), value.isConfiguration())) { emitConfigNode(value.isConfiguration()); } emitDocumentedNodeRefine(original, value); }
public static CharSequence writeContSchemaNode(final ContainerSchemaNode contSchemaNode) { StringConcatenation _builder = new StringConcatenation(); _builder.append("container "); QName _qName = contSchemaNode.getQName(); String _localName = _qName.getLocalName(); _builder.append(_localName, ""); Collection<DataSchemaNode> _childNodes = contSchemaNode.getChildNodes(); boolean _isNullOrEmpty = IterableExtensions.isNullOrEmpty(_childNodes); boolean _not = (!_isNullOrEmpty); if (_not) { _builder.append(" "); Collection<DataSchemaNode> _childNodes_1 = contSchemaNode.getChildNodes(); CharSequence _writeDataSchemaNodes = YangTemplate.writeDataSchemaNodes(_childNodes_1); _builder.append(_writeDataSchemaNodes, " "); Set<AugmentationSchema> _availableAugmentations = contSchemaNode.getAvailableAugmentations(); boolean _isNullOrEmpty_1 = IterableExtensions.isNullOrEmpty(_availableAugmentations); boolean _not_1 = (!_isNullOrEmpty_1); if (_not_1) { _builder.append(" "); Set<AugmentationSchema> _availableAugmentations_1 = contSchemaNode.getAvailableAugmentations(); CharSequence _writeAugments = YangTemplate.writeAugments(_availableAugmentations_1); _builder.append(_writeAugments, " "); Set<GroupingDefinition> _groupings = contSchemaNode.getGroupings(); boolean _isNullOrEmpty_2 = IterableExtensions.isNullOrEmpty(_groupings); boolean _not_2 = (!_isNullOrEmpty_2); if (_not_2) { _builder.append(" ");
private GeneratedType actionContainer(final ModuleContext context, final Type baseInterface, final ContainerSchemaNode schema) { final GeneratedTypeBuilder genType = processDataSchemaNode(context, baseInterface, schema); resolveDataSchemaNodes(context, genType, genType, schema.getChildNodes()); return genType.build(); }
private Type createRpcContainer(final ModuleContext context, final String rpcName, final RpcDefinition rpc, final ContainerSchemaNode schema, final Type type) { processUsesAugments(schema, context); final GeneratedTypeBuilder outType = addRawInterfaceDefinition( JavaTypeName.create(context.modulePackageName(), rpcName + BindingMapping.getClassName(schema.getQName())), schema); addImplementedInterfaceFromUses(schema, outType); outType.addImplementsType(type); outType.addImplementsType(augmentable(outType)); annotateDeprecatedIfNecessary(rpc.getStatus(), outType); resolveDataSchemaNodes(context, outType, outType, schema.getChildNodes()); context.addChildNodeType(schema, outType); return outType.build(); }
@Override public final void startContainerNode(final NodeIdentifier name, final int childSizeHint) throws IOException { final SchemaNode schema = tracker.startContainerNode(name); final boolean isPresence = schema instanceof ContainerSchemaNode ? ((ContainerSchemaNode) schema).isPresenceContainer() : DEFAULT_EMIT_EMPTY_CONTAINERS; context = new JSONStreamWriterNamedObjectContext(context, name, isPresence); }
return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0)); return (Element) transformNormalizedNode(document, result.getResult(), rpcDefinition.getOutput().getPath()); } catch (DOMRpcException e) { throw DocumentedException.wrap(e);
private void emitOutput(final @NonNull ContainerSchemaNode output) { if (isExplicitStatement(output)) { super.writer.startOutputNode(); output.getMustConstraints().forEach(this::emitMust); emitDataNodeContainer(output); emitUnknownStatementNodes(output.getUnknownSchemaNodes()); super.writer.endNode(); } }
ContainerSchemaNode input = rpc.getInput(); if (input != null) { for (UsesNode uses : input.getUses()) {
public static RpcRoutingStrategy from(final RpcDefinition rpc) { ContainerSchemaNode input = rpc.getInput(); if (input != null) { for (DataSchemaNode schemaNode : input.getChildNodes()) { Optional<QName> context = getRoutingContext(schemaNode); if (context.isPresent()) { return new RoutedRpcStrategy(rpc.getQName(), context.get(), schemaNode.getQName()); } } } return new GlobalRpcStrategy(rpc.getQName()); }
@Override public final void startContainerNode(final NodeIdentifier name, final int childSizeHint) throws IOException { final SchemaNode schema = tracker.startContainerNode(name); final boolean isPresence = schema instanceof ContainerSchemaNode ? ((ContainerSchemaNode) schema).isPresenceContainer() : DEFAULT_EMIT_EMPTY_CONTAINERS; context = new JSONStreamWriterNamedObjectContext(context, name, isPresence); }
return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0)); return (Element) transformNormalizedNode(document, result.getResult(), rpcDefinition.getOutput().getPath()); } catch (DOMRpcException e) { throw NetconfDocumentedException.wrap(e);
private void emitInput(final @NonNull ContainerSchemaNode input) { if (isExplicitStatement(input)) { super.writer.startInputNode(); input.getMustConstraints().forEach(this::emitMust); emitDataNodeContainer(input); emitUnknownStatementNodes(input.getUnknownSchemaNodes()); super.writer.endNode(); } }
StructuralContainerModificationStrategy(final ContainerSchemaNode schema, final DataTreeConfiguration treeConfig) { super(schema, treeConfig); this.emptyNode = ImmutableNodes.containerNode(schema.getQName()); }
public static RpcRoutingStrategy from(final RpcDefinition rpc) { ContainerSchemaNode input = rpc.getInput(); if (input != null) { for (DataSchemaNode schemaNode : input.getChildNodes()) { Optional<QName> context = getRoutingContext(schemaNode); if (context.isPresent()) { return new RoutedRpcStrategy(rpc.getQName(), context.get(), schemaNode.getQName()); } } } return new GlobalRpcStrategy(rpc.getQName()); }
/** * Check if new data are empty but still to be considered as a modification, meaning it's presence has a meaning * e.g. containers with presence statement. */ private static boolean isEmptyPresenceNode(@Nonnull final Modification modification) { return modification.is(ContainerSchemaNode.class) && ((ContainerSchemaNode) modification.getSchemaNode()).isPresenceContainer() && modification.getChildNodes().isEmpty() && VALID_MODIFICATIONS.contains(modification.getModificationType()); }
path = ((RpcDefinition) context.getSchemaNode()).getOutput().getPath(); nnWriter = createNormalizedNodeWriter(context,path,jsonWriter, depth); jsonWriter.name("output");
ContainerTransformation(final ContainerSchemaNode schema) { super(NodeIdentifier.create(schema.getQName()), schema); }