X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=nbinotifications%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fnbinotifications%2Fimpl%2Frpc%2FDeleteNotificationSubscriptionServiceImpl.java;h=726d9c67adf960657226290f3eb9276a932f0b7b;hb=refs%2Fchanges%2F19%2F110719%2F6;hp=68e13fde295f64363f0e16bfe9eb6d09d31f44ce;hpb=0832ac89899899a5ad67a0602caec18a8be85670;p=transportpce.git diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/rpc/DeleteNotificationSubscriptionServiceImpl.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/rpc/DeleteNotificationSubscriptionServiceImpl.java index 68e13fde2..726d9c67a 100644 --- a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/rpc/DeleteNotificationSubscriptionServiceImpl.java +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/rpc/DeleteNotificationSubscriptionServiceImpl.java @@ -41,8 +41,8 @@ public class DeleteNotificationSubscriptionServiceImpl implements DeleteNotifica private final NetworkTransactionService networkTransactionService; private final TopicManager topicManager; - public DeleteNotificationSubscriptionServiceImpl(NetworkTransactionService networkTransactionService, - TopicManager topicManager) { + public DeleteNotificationSubscriptionServiceImpl( + NetworkTransactionService networkTransactionService, TopicManager topicManager) { this.networkTransactionService = networkTransactionService; this.topicManager = topicManager; } @@ -54,40 +54,40 @@ public class DeleteNotificationSubscriptionServiceImpl implements DeleteNotifica if (input == null || input.getUuid() == null) { LOG.warn("Missing mandatory params for input {}", input); return RpcResultBuilder.failed() - .withError(ErrorType.RPC, "Missing input parameters").buildFuture(); + .withError(ErrorType.RPC, "Missing input parameters") + .buildFuture(); } Uuid notifSubsUuid = input.getUuid(); InstanceIdentifier notifSubscriptionIID = InstanceIdentifier.builder(Context.class) - .augmentation(Context1.class).child(NotificationContext.class).child(NotifSubscription.class, - new NotifSubscriptionKey(notifSubsUuid)).build(); - Optional optionalNotifSub = this.networkTransactionService.read( - LogicalDatastoreType.OPERATIONAL, notifSubscriptionIID).get(); - + .augmentation(Context1.class) + .child(NotificationContext.class) + .child(NotifSubscription.class, new NotifSubscriptionKey(notifSubsUuid)) + .build(); + Optional optionalNotifSub = this.networkTransactionService + .read(LogicalDatastoreType.OPERATIONAL, notifSubscriptionIID) + .get(); if (optionalNotifSub.isEmpty()) { return RpcResultBuilder.failed() - .withError(ErrorType.APPLICATION, - "Notification subscription doesnt exist").buildFuture(); + .withError(ErrorType.APPLICATION, "Notification subscription doesnt exist") + .buildFuture(); } NotifSubscription notifSubscription = optionalNotifSub.orElseThrow(); this.networkTransactionService.delete(LogicalDatastoreType.OPERATIONAL, notifSubscriptionIID); this.networkTransactionService.commit().get(); - for (Map.Entry sfEntry : notifSubscription - .getSubscriptionFilter().entrySet()) { + for (Map.Entry sfEntry : + notifSubscription.getSubscriptionFilter().entrySet()) { for (Uuid objectUuid:sfEntry.getValue().getRequestedObjectIdentifier()) { this.topicManager.deleteTapiTopic(objectUuid.getValue()); } } -// for (Uuid objectUuid:notifSubscription.getSubscriptionFilter().getRequestedObjectIdentifier()) { -// this.topicManager.deleteTapiTopic(objectUuid.getValue()); -// } - return RpcResultBuilder.success(new DeleteNotificationSubscriptionServiceOutputBuilder().build()) + return RpcResultBuilder + .success(new DeleteNotificationSubscriptionServiceOutputBuilder().build()) .buildFuture(); } catch (InterruptedException | ExecutionException | NoSuchElementException e) { LOG.error("Failed to delete Notification subscription service", e); } return RpcResultBuilder.failed() - .withError(ErrorType.APPLICATION, - "Failed to delete notification subscription service").buildFuture(); + .withError(ErrorType.APPLICATION, "Failed to delete notification subscription service") + .buildFuture(); } - }