use of org.eclipse.milo.opcua.stack.core.types.structured.DeleteNodesResponse in project milo by eclipse.
the class DefaultNodeManagementServiceSet method onDeleteNodes.
@Override
public void onDeleteNodes(ServiceRequest service) {
OpcUaServer server = service.attr(ServiceAttributes.SERVER_KEY).get();
Session session = service.attr(ServiceAttributes.SESSION_KEY).get();
DeleteNodesRequest request = (DeleteNodesRequest) service.getRequest();
List<DeleteNodesItem> nodesToDelete = l(request.getNodesToDelete());
if (nodesToDelete.isEmpty()) {
service.setServiceFault(StatusCodes.Bad_NothingToDo);
return;
}
if (nodesToDelete.size() > server.getConfig().getLimits().getMaxNodesPerNodeManagement().longValue()) {
service.setServiceFault(StatusCodes.Bad_TooManyOperations);
return;
}
DeleteNodesContext context = new DeleteNodesContext(server, session, new DiagnosticsContext<>());
server.getAddressSpaceManager().deleteNodes(context, nodesToDelete);
context.getFuture().thenAccept(results -> {
ResponseHeader header = service.createResponseHeader();
DeleteNodesResponse response = new DeleteNodesResponse(header, a(results, StatusCode.class), new DiagnosticInfo[0]);
service.setResponse(response);
});
}
Aggregations