*/
package org.opendaylight.netconf.sal.streams.listeners;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
import java.io.StringReader;
import java.time.Instant;
import java.util.Optional;
private Instant stop = null;
private String filter = null;
private boolean leafNodesOnly = false;
+ private boolean skipNotificationData = false;
@VisibleForTesting
public final Instant getStart() {
* indicate which subset of all possible events are of interest
* @param leafNodesOnly
* if true, notifications will contain changes to leaf nodes only
+ * @param skipNotificationData
+ * if true, notification will not contain changed data
*/
@SuppressWarnings("checkstyle:hiddenField")
public void setQueryParams(final Instant start, final Optional<Instant> stop, final Optional<String> filter,
- final boolean leafNodesOnly) {
- this.start = Preconditions.checkNotNull(start);
+ final boolean leafNodesOnly, final boolean skipNotificationData) {
+ this.start = requireNonNull(start);
this.stop = stop.orElse(null);
this.filter = filter.orElse(null);
this.leafNodesOnly = leafNodesOnly;
+ this.skipNotificationData = skipNotificationData;
}
/**
}
/**
- * Checking query parameters on specific notification.
+ * Check whether this query should notify changes without data.
*
- * @param xml data of notification
- * @param listener listener of notification
- * @return true if notification meets the requirements of query parameters,
- * false otherwise
+ * @return true if this query should notify about changes with data
*/
+ public boolean isSkipNotificationData() {
+ return skipNotificationData;
+ }
+
@SuppressWarnings("checkstyle:IllegalCatch")
- protected <T extends BaseListenerInterface> boolean checkQueryParams(final String xml, final T listener) {
- final Instant now = Instant.now();
+ <T extends BaseListenerInterface> boolean checkStartStop(final Instant now, final T listener) {
if (this.stop != null) {
- if ((this.start.compareTo(now) < 0) && (this.stop.compareTo(now) > 0)) {
- return checkFilter(xml);
+ if (this.start.compareTo(now) < 0 && this.stop.compareTo(now) > 0) {
+ return true;
}
if (this.stop.compareTo(now) < 0) {
try {
} else if (this.start != null) {
if (this.start.compareTo(now) < 0) {
this.start = null;
- return checkFilter(xml);
+ return true;
}
} else {
- return checkFilter(xml);
+ return true;
}
return false;
}
* @param xml data of notification
*/
@SuppressWarnings("checkstyle:IllegalCatch")
- private boolean checkFilter(final String xml) {
+ boolean checkFilter(final String xml) {
if (this.filter == null) {
return true;
}