From: guillaume.lambert Date: Wed, 13 Mar 2024 16:01:00 +0000 (+0100) Subject: Fix inventory listeners code style X-Git-Tag: 9.0.0~29 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=transportpce.git;a=commitdiff_plain;h=3b0d4d71976ceb11d926241cd40b26b912487df4 Fix inventory listeners code style Signed-off-by: guillaume.lambert Change-Id: I8120d9e53faf337ab4e32705782ba844ce58ca60 --- 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 +}