// RPC operations (via post) - RPCs have their own path
for (final var rpc : module.getRpcs()) {
final var localName = rpc.getQName().getLocalName();
- final var post = new PostEntity(rpc, deviceName, module.getName(), new ArrayList<>(), localName, null);
+ final var post = new PostEntity(rpc, deviceName, module.getName(), List.of(), localName, null,
+ List.of());
final var resolvedPath = basePath + OPERATIONS + urlPrefix + "/" + module.getName() + ":" + localName;
final var entity = new PathEntity(resolvedPath, post);
result.add(entity);
if (isConfig && !hasRootPostLink && isForSingleModule) {
final var resolvedPath = basePath + DATA + urlPrefix;
result.add(new PathEntity(resolvedPath,
- new PostEntity(node, deviceName, moduleName, new ArrayList<>(), nodeLocalName, module)));
+ new PostEntity(node, deviceName, moduleName, List.of(), nodeLocalName, module, List.of())));
hasRootPostLink = true;
}
//process first node
final var localName = moduleName + ":" + nodeLocalName;
final var path = urlPrefix + "/" + processPath(node, pathParams, localName);
processChildNode(node, pathParams, moduleName, result, path, nodeLocalName, isConfig, schemaContext,
- deviceName, basePath, null);
+ deviceName, basePath, null, List.of());
}
}
return result;
private static void processChildNode(final DataSchemaNode node, final List<ParameterEntity> pathParams,
final String moduleName, final Deque<PathEntity> result, final String path, final String refPath,
final boolean isConfig, final EffectiveModelContext schemaContext, final String deviceName,
- final String basePath, final SchemaNode parentNode) {
+ final String basePath, final SchemaNode parentNode, final List<SchemaNode> parentNodes) {
final var resourcePath = basePath + DATA + path;
final var fullName = resolveFullNameFromNode(node.getQName(), schemaContext);
final var firstChild = getListOrContainerChildNode((DataNodeContainer) node);
isConfig, fullName, deviceName));
}
final var childNodes = ((DataNodeContainer) node).getChildNodes();
+ final var listOfParents = new ArrayList<>(parentNodes);
+ if (parentNode != null) {
+ listOfParents.add(parentNode);
+ }
if (node instanceof ActionNodeContainer actionContainer) {
+ final var listOfParentsForActions = new ArrayList<>(listOfParents);
+ listOfParentsForActions.add(node);
final var actionParams = new ArrayList<>(pathParams);
actionContainer.getActions().forEach(actionDef -> {
final var resourceActionPath = path + "/" + resolvePathArgumentsName(actionDef.getQName(),
node.getQName(), schemaContext);
final var childPath = basePath + OPERATIONS + resourceActionPath;
result.add(processActionPathEntity(actionDef, childPath, actionParams, moduleName,
- refPath, deviceName, parentNode));
+ refPath, deviceName, parentNode, listOfParentsForActions));
});
}
for (final var childNode : childNodes) {
- final var childParams = new ArrayList<>(pathParams);
- final var newRefPath = refPath + "_" + childNode.getQName().getLocalName();
if (childNode instanceof ListSchemaNode || childNode instanceof ContainerSchemaNode) {
+ final var childParams = new ArrayList<>(pathParams);
+ final var newRefPath = refPath + "_" + childNode.getQName().getLocalName();
final var localName = resolvePathArgumentsName(childNode.getQName(), node.getQName(), schemaContext);
final var resourceDataPath = path + "/" + processPath(childNode, childParams, localName);
final var newConfig = isConfig && childNode.isConfiguration();
processChildNode(childNode, childParams, moduleName, result, resourceDataPath, newRefPath, newConfig,
- schemaContext, deviceName, basePath, node);
+ schemaContext, deviceName, basePath, node, listOfParents);
}
}
}
final boolean isConfig, final String fullName, final SchemaNode childNode, final String deviceName) {
if (isConfig) {
final var childNodeRefPath = refPath + "_" + childNode.getQName().getLocalName();
- var post = new PostEntity(childNode, deviceName, moduleName, pathParams, childNodeRefPath, node);
+ var post = new PostEntity(childNode, deviceName, moduleName, pathParams, childNodeRefPath, node, List.of());
if (!((DataSchemaNode) childNode).isConfiguration()) {
- post = new PostEntity(node, deviceName, moduleName, pathParams, refPath, null);
+ post = new PostEntity(node, deviceName, moduleName, pathParams, refPath, null, List.of());
}
return new PathEntity(resourcePath, post,
new PatchEntity(node, deviceName, moduleName, pathParams, refPath, fullName),
private static PathEntity processActionPathEntity(final SchemaNode node, final String resourcePath,
final List<ParameterEntity> pathParams, final String moduleName, final String refPath,
- final String deviceName, final SchemaNode parentNode) {
+ final String deviceName, final SchemaNode parentNode, final List<SchemaNode> parentNodes) {
return new PathEntity(resourcePath,
- new PostEntity(node, deviceName, moduleName, pathParams, refPath, parentNode));
+ new PostEntity(node, deviceName, moduleName, pathParams, refPath, parentNode, parentNodes));
}
private static String processPath(final DataSchemaNode node, final List<ParameterEntity> pathParams,