Add Child Nodes Only query parameter to SSE events
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / rfc8040 / streams / listeners / AbstractCommonSubscriber.java
index beda17a4561452547c0525c686b2d2ad40877352..9cbae2d7ca77787ac198fb8cdf74b61e58c9ebd9 100644 (file)
@@ -66,6 +66,7 @@ abstract class AbstractCommonSubscriber<T> extends AbstractNotificationsData imp
     private boolean leafNodesOnly = false;
     private boolean skipNotificationData = false;
     private boolean changedLeafNodesOnly = false;
+    private boolean childNodesOnly = false;
     private EventFormatter<T> formatter;
 
     AbstractCommonSubscriber(final String streamName, final NotificationOutputType outputType,
@@ -150,6 +151,9 @@ abstract class AbstractCommonSubscriber<T> extends AbstractNotificationsData imp
         final var changedLeafNodes = params.changedLeafNodesOnly();
         changedLeafNodesOnly = changedLeafNodes != null && changedLeafNodes.value();
 
+        final var childNodes = params.childNodesOnly();
+        childNodesOnly = childNodes != null && childNodes.value();
+
         final var filter = params.filter();
         final String filterValue = filter == null ? null : filter.paramValue();
         if (filterValue != null && !filterValue.isEmpty()) {
@@ -190,6 +194,15 @@ abstract class AbstractCommonSubscriber<T> extends AbstractNotificationsData imp
         return skipNotificationData;
     }
 
+    /**
+     * Check whether this query should only notify about child node changes.
+     *
+     * @return true if this query should only notify about child node changes
+     */
+    final boolean getChildNodesOnly() {
+        return childNodesOnly;
+    }
+
     final EventFormatter<T> formatter() {
         return formatter;
     }