From 3b0d4d71976ceb11d926241cd40b26b912487df4 Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Wed, 13 Mar 2024 17:01:00 +0100 Subject: [PATCH] Fix inventory listeners code style Signed-off-by: guillaume.lambert Change-Id: I8120d9e53faf337ab4e32705782ba844ce58ca60 --- .../listener/DeviceConfigListener.java | 18 ++++++++--------- .../inventory/listener/DeviceListener.java | 20 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/inventory/src/main/java/org/opendaylight/transportpce/inventory/listener/DeviceConfigListener.java b/inventory/src/main/java/org/opendaylight/transportpce/inventory/listener/DeviceConfigListener.java index ad1c73b30..837f225dd 100644 --- a/inventory/src/main/java/org/opendaylight/transportpce/inventory/listener/DeviceConfigListener.java +++ b/inventory/src/main/java/org/opendaylight/transportpce/inventory/listener/DeviceConfigListener.java @@ -59,7 +59,7 @@ public class DeviceConfigListener implements DataTreeChangeListener { long count = netconfNode.getAvailableCapabilities().getAvailableCapability().stream() .filter(cp -> cp.getCapability().contains(StringConstants.OPENROADM_DEVICE_MODEL_NAME)) .count(); - LOG.debug("DCL Modification Type {}", device.getRootNode().modificationType().toString()); + LOG.debug("DCL Modification Type {}", device.getRootNode().modificationType()); LOG.debug("DCL Capability Count {}", count); LOG.debug("DCL Connection Status {}", connectionStatus); if (isCreate(device) || isUpdate(device)) { @@ -111,16 +111,16 @@ public class DeviceConfigListener implements DataTreeChangeListener { */ private static List> getRealDevicesOnly(Collection> changes) { return changes.stream() - .filter(change -> (change.getRootNode().dataAfter() != null + .filter(change -> + (change.getRootNode().dataAfter() != null && !StringConstants.DEFAULT_NETCONF_NODEID - .equalsIgnoreCase(change.getRootNode().dataAfter().key().getNodeId().getValue()) + .equalsIgnoreCase(change.getRootNode().dataAfter().key().getNodeId().getValue()) && change.getRootNode().dataAfter().augmentation(NetconfNode.class) != null) - || (change.getRootNode().dataBefore() != null - && !StringConstants.DEFAULT_NETCONF_NODEID.equalsIgnoreCase( - change.getRootNode().dataBefore().key().getNodeId().getValue()) - && change.getRootNode().dataBefore().augmentation(NetconfNode.class) != null - - )).collect(Collectors.toList()); + || (change.getRootNode().dataBefore() != null + && !StringConstants.DEFAULT_NETCONF_NODEID + .equalsIgnoreCase(change.getRootNode().dataBefore().key().getNodeId().getValue()) + && change.getRootNode().dataBefore().augmentation(NetconfNode.class) != null)) + .collect(Collectors.toList()); } /** diff --git a/inventory/src/main/java/org/opendaylight/transportpce/inventory/listener/DeviceListener.java b/inventory/src/main/java/org/opendaylight/transportpce/inventory/listener/DeviceListener.java index dac8cd441..7e51845b5 100644 --- a/inventory/src/main/java/org/opendaylight/transportpce/inventory/listener/DeviceListener.java +++ b/inventory/src/main/java/org/opendaylight/transportpce/inventory/listener/DeviceListener.java @@ -52,7 +52,7 @@ public class DeviceListener implements DataTreeChangeListener { long count = netconfNode.getAvailableCapabilities().getAvailableCapability().stream() .filter(cp -> cp.getCapability().contains(StringConstants.OPENROADM_DEVICE_MODEL_NAME)) .count(); - LOG.debug("DL Modification Type {}", device.getRootNode().modificationType().toString()); + LOG.debug("DL Modification Type {}", device.getRootNode().modificationType()); LOG.debug("DL Capability Count {}", count); LOG.debug("DL Connection Status {}", connectionStatus); LOG.debug("DL device.getRootNode().getDataBefore() {}", device.getRootNode().dataBefore()); @@ -111,16 +111,16 @@ public class DeviceListener implements DataTreeChangeListener { */ private static List> getRealDevicesOnly(Collection> changes) { return changes.stream() - .filter(change -> (change.getRootNode().dataAfter() != null + .filter(change -> + (change.getRootNode().dataAfter() != null && !StringConstants.DEFAULT_NETCONF_NODEID - .equalsIgnoreCase(change.getRootNode().dataAfter().key().getNodeId().getValue()) + .equalsIgnoreCase(change.getRootNode().dataAfter().key().getNodeId().getValue()) && change.getRootNode().dataAfter().augmentation(NetconfNode.class) != null) - || (change.getRootNode().dataBefore() != null - && !StringConstants.DEFAULT_NETCONF_NODEID.equalsIgnoreCase( - change.getRootNode().dataBefore().key().getNodeId().getValue()) - && change.getRootNode().dataBefore().augmentation(NetconfNode.class) != null - - )).collect(Collectors.toList()); + || (change.getRootNode().dataBefore() != null + && !StringConstants.DEFAULT_NETCONF_NODEID + .equalsIgnoreCase(change.getRootNode().dataBefore().key().getNodeId().getValue()) + && change.getRootNode().dataBefore().augmentation(NetconfNode.class) != null)) + .collect(Collectors.toList()); } /** @@ -139,4 +139,4 @@ public class DeviceListener implements DataTreeChangeListener { return change.getRootNode().dataBefore() != null && change.getRootNode().dataAfter() == null && ModificationType.DELETE.equals(change.getRootNode().modificationType()); } -} \ No newline at end of file +} -- 2.36.6