Fix filtering by device name not working with all and device subscriptions

pull/451/head
Nipuni Kavindya 4 months ago
parent f0fafde0d2
commit 9561e003bf

@ -2469,10 +2469,10 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
OwnerWithDeviceDTO ownerWithDevice = OwnerWithDeviceDTO ownerWithDevice =
deviceManagementProviderService.getOwnerWithDeviceByDeviceId(deviceId, request.getOwner(), request.getDeviceName(), deviceManagementProviderService.getOwnerWithDeviceByDeviceId(deviceId, request.getOwner(), request.getDeviceName(),
request.getDeviceStatus()); request.getDeviceStatus());
if (ownerWithDevice == null) { if (ownerWithDevice == null || (request.getDeviceName() != null && !request.getDeviceName().isEmpty() &&
(ownerWithDevice.getDeviceNames() == null || !ownerWithDevice.getDeviceNames().contains(request.getDeviceName())))) {
continue; continue;
} }
if (deviceSubscriptionMap.containsKey(deviceId)) { if (deviceSubscriptionMap.containsKey(deviceId)) {
DeviceSubscriptionDTO subscription = deviceSubscriptionMap.get(deviceId); DeviceSubscriptionDTO subscription = deviceSubscriptionMap.get(deviceId);
DeviceSubscriptionData deviceDetail = new DeviceSubscriptionData(); DeviceSubscriptionData deviceDetail = new DeviceSubscriptionData();
@ -2664,10 +2664,10 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
OwnerWithDeviceDTO ownerWithDevice = OwnerWithDeviceDTO ownerWithDevice =
deviceManagementProviderService.getOwnerWithDeviceByDeviceId(deviceId, request.getOwner(), request.getDeviceName(), deviceManagementProviderService.getOwnerWithDeviceByDeviceId(deviceId, request.getOwner(), request.getDeviceName(),
request.getDeviceStatus()); request.getDeviceStatus());
if (ownerWithDevice == null) { if (ownerWithDevice == null || (request.getDeviceName() != null && !request.getDeviceName().isEmpty() &&
(ownerWithDevice.getDeviceNames() == null || !ownerWithDevice.getDeviceNames().contains(request.getDeviceName())))) {
continue; continue;
} }
if (allSubscriptionMap.containsKey(deviceId)) { if (allSubscriptionMap.containsKey(deviceId)) {
DeviceSubscriptionDTO subscription = allSubscriptionMap.get(deviceId); DeviceSubscriptionDTO subscription = allSubscriptionMap.get(deviceId);
DeviceSubscriptionData deviceDetail = new DeviceSubscriptionData(); DeviceSubscriptionData deviceDetail = new DeviceSubscriptionData();

Loading…
Cancel
Save