From 9561e003bf47441302ecc05e3ac26fb08c2d6f75 Mon Sep 17 00:00:00 2001 From: nipuni Date: Mon, 15 Jul 2024 09:14:20 +0530 Subject: [PATCH] Fix filtering by device name not working with all and device subscriptions --- .../mgt/core/impl/SubscriptionManagerImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java index a8a0a8cfa6..065c9576bd 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -2469,10 +2469,10 @@ public class SubscriptionManagerImpl implements SubscriptionManager { OwnerWithDeviceDTO ownerWithDevice = deviceManagementProviderService.getOwnerWithDeviceByDeviceId(deviceId, request.getOwner(), request.getDeviceName(), request.getDeviceStatus()); - if (ownerWithDevice == null) { + if (ownerWithDevice == null || (request.getDeviceName() != null && !request.getDeviceName().isEmpty() && + (ownerWithDevice.getDeviceNames() == null || !ownerWithDevice.getDeviceNames().contains(request.getDeviceName())))) { continue; } - if (deviceSubscriptionMap.containsKey(deviceId)) { DeviceSubscriptionDTO subscription = deviceSubscriptionMap.get(deviceId); DeviceSubscriptionData deviceDetail = new DeviceSubscriptionData(); @@ -2664,10 +2664,10 @@ public class SubscriptionManagerImpl implements SubscriptionManager { OwnerWithDeviceDTO ownerWithDevice = deviceManagementProviderService.getOwnerWithDeviceByDeviceId(deviceId, request.getOwner(), request.getDeviceName(), request.getDeviceStatus()); - if (ownerWithDevice == null) { + if (ownerWithDevice == null || (request.getDeviceName() != null && !request.getDeviceName().isEmpty() && + (ownerWithDevice.getDeviceNames() == null || !ownerWithDevice.getDeviceNames().contains(request.getDeviceName())))) { continue; } - if (allSubscriptionMap.containsKey(deviceId)) { DeviceSubscriptionDTO subscription = allSubscriptionMap.get(deviceId); DeviceSubscriptionData deviceDetail = new DeviceSubscriptionData();