use of org.eclipse.milo.opcua.sdk.server.api.services.NodeManagementServices.DeleteReferencesContext in project milo by eclipse.
the class DefaultNodeManagementServiceSet method onDeleteReferences.
@Override
public void onDeleteReferences(ServiceRequest service) {
OpcUaServer server = service.attr(ServiceAttributes.SERVER_KEY).get();
Session session = service.attr(ServiceAttributes.SESSION_KEY).get();
DeleteReferencesRequest request = (DeleteReferencesRequest) service.getRequest();
List<DeleteReferencesItem> referencesToDelete = l(request.getReferencesToDelete());
if (referencesToDelete.isEmpty()) {
service.setServiceFault(StatusCodes.Bad_NothingToDo);
return;
}
if (referencesToDelete.size() > server.getConfig().getLimits().getMaxNodesPerNodeManagement().longValue()) {
service.setServiceFault(StatusCodes.Bad_TooManyOperations);
return;
}
DeleteReferencesContext context = new DeleteReferencesContext(server, session, new DiagnosticsContext<>());
server.getAddressSpaceManager().deleteReferences(context, referencesToDelete);
context.getFuture().thenAccept(results -> {
ResponseHeader header = service.createResponseHeader();
DeleteReferencesResponse response = new DeleteReferencesResponse(header, a(results, StatusCode.class), new DiagnosticInfo[0]);
service.setResponse(response);
});
}
Aggregations