Merge branch 'fix-1189' into 'master'

Remove duplicate app subscriptions

See merge request entgra/carbon-device-mgt!820
temp
Pahansith Gunathilake 3 years ago
commit 76782a9bb7

@ -97,9 +97,11 @@ import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -434,7 +436,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
DeviceManagementProviderService deviceManagementProviderService = HelperUtil DeviceManagementProviderService deviceManagementProviderService = HelperUtil
.getDeviceManagementProviderService(); .getDeviceManagementProviderService();
GroupManagementProviderService groupManagementProviderService = HelperUtil.getGroupManagementProviderService(); GroupManagementProviderService groupManagementProviderService = HelperUtil.getGroupManagementProviderService();
List<Device> devices = new ArrayList<>(); Set<Device> devices = new HashSet<>();
List<String> subscribers = new ArrayList<>(); List<String> subscribers = new ArrayList<>();
List<DeviceIdentifier> errorDeviceIdentifiers = new ArrayList<>(); List<DeviceIdentifier> errorDeviceIdentifiers = new ArrayList<>();
String deviceTypeName = null; String deviceTypeName = null;
@ -511,8 +513,10 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
devices.removeIf(device -> !tmpDeviceTypeName.equals(device.getType())); devices.removeIf(device -> !tmpDeviceTypeName.equals(device.getType()));
} }
List<Device> deviceList = new ArrayList<>();
deviceList.addAll(devices);
ApplicationSubscriptionInfo applicationSubscriptionInfo = new ApplicationSubscriptionInfo(); ApplicationSubscriptionInfo applicationSubscriptionInfo = new ApplicationSubscriptionInfo();
applicationSubscriptionInfo.setDevices(devices); applicationSubscriptionInfo.setDevices(deviceList);
applicationSubscriptionInfo.setSubscribers(subscribers); applicationSubscriptionInfo.setSubscribers(subscribers);
applicationSubscriptionInfo.setErrorDeviceIdentifiers(errorDeviceIdentifiers); applicationSubscriptionInfo.setErrorDeviceIdentifiers(errorDeviceIdentifiers);
applicationSubscriptionInfo.setAppSupportingDeviceTypeName(deviceTypeName); applicationSubscriptionInfo.setAppSupportingDeviceTypeName(deviceTypeName);

Loading…
Cancel
Save