*/
@Nullable
private NormalizedNode<?, ?> rpcToNNode(final XmlElement oElement, @Nullable final ContainerSchemaNode input) {
- return input == null ? null : DomToNormalizedNodeParserFactory
+ return input.getChildNodes().isEmpty() ? null : DomToNormalizedNodeParserFactory
.getInstance(DomUtils.defaultValueCodecProvider(), schemaContext.getCurrentContext())
.getContainerNodeParser()
.parse(Collections.singletonList(oElement.getDomElement()), input);
Preconditions.checkNotNull(mappedRpcs.get(rpcQName), "Unknown rpc %s, available rpcs: %s", rpcQName, mappedRpcs.keySet());
final DOMResult domResult = NetconfMessageTransformUtil.prepareDomResultForRpcRequest(rpcQName, counter);
- if(mappedRpcs.get(rpcQName).getInput() == null) {
+ if (mappedRpcs.get(rpcQName).getInput().getChildNodes().isEmpty()) {
return new NetconfMessage(domResult.getNode().getOwnerDocument());
}
}
Preconditions.checkNotNull(currentMappedRpcs.get(rpcQName), "Unknown rpc %s, available rpcs: %s", rpcQName, currentMappedRpcs.keySet());
- if(currentMappedRpcs.get(rpcQName).getInput() == null) {
+ if(currentMappedRpcs.get(rpcQName).getInput().getChildNodes().isEmpty()) {
return new NetconfMessage(NetconfMessageTransformUtil.prepareDomResultForRpcRequest(rpcQName, counter).getNode().getOwnerDocument());
}
Preconditions.checkArgument(rpcDefinition != null, "Unable to parse response of %s, the rpc is unknown", rpcQName);
// In case no input for rpc is defined, we can simply construct the payload here
- if (rpcDefinition.getOutput() == null) {
+ if (rpcDefinition.getOutput().getChildNodes().isEmpty()) {
Preconditions.checkArgument(XmlElement.fromDomDocument(
message.getDocument()).getOnlyChildElementWithSameNamespaceOptionally("ok").isPresent(),
"Unexpected content in response of rpc: %s, %s", rpcDefinition.getQName(), message);
throw new RestconfDocumentedException("RPC does not exist.", ErrorType.RPC, ErrorTag.UNKNOWN_ELEMENT);
}
- if (rpc.getInput() != null) {
+ if (!rpc.getInput().getChildNodes().isEmpty()) {
LOG.debug("RPC " + rpc + " does not need input value.");
// FIXME : find a correct Error from specification
throw new IllegalStateException("RPC " + rpc + " does'n need input value!");
operationSpec.setMethod("POST");
operationSpec.setNotes(rpcDefn.getDescription());
operationSpec.setNickname(rpcDefn.getQName().getLocalName());
- if (rpcDefn.getOutput() != null) {
+ if (!rpcDefn.getOutput().getChildNodes().isEmpty()) {
operationSpec.setType("(" + rpcDefn.getQName().getLocalName() + ")output" + OperationBuilder.TOP);
}
- if (rpcDefn.getInput() != null) {
+ if (!rpcDefn.getInput().getChildNodes().isEmpty()) {
final Parameter payload = new Parameter();
payload.setParamType("body");
payload.setType("(" + rpcDefn.getQName().getLocalName() + ")input" + OperationBuilder.TOP);
final String moduleName = module.getName();
for (final RpcDefinition rpc : rpcs) {
final ContainerSchemaNode input = rpc.getInput();
- if (input != null) {
+ if (!input.getChildNodes().isEmpty()) {
final JSONObject properties = processChildren(input.getChildNodes(), moduleName, models, true, schemaContext);
final String filename = "(" + rpc.getQName().getLocalName() + ")input";
}
final ContainerSchemaNode output = rpc.getOutput();
- if (output != null) {
+ if (!output.getChildNodes().isEmpty()) {
final JSONObject properties = processChildren(output.getChildNodes(), moduleName, models, true, schemaContext);
final String filename = "(" + rpc.getQName().getLocalName() + ")output";
final JSONObject childSchema = getSchemaTemplate();