Used constants instead of hardcoding

status
Ruwin Dissanayake 3 months ago
parent 6934827920
commit 0609b3a9c2

@ -39,6 +39,7 @@ import io.entgra.device.mgt.core.application.mgt.core.util.HelperUtil;
import io.entgra.device.mgt.core.application.mgt.core.util.subscription.mgt.SubscriptionManagementHelperUtil; import io.entgra.device.mgt.core.application.mgt.core.util.subscription.mgt.SubscriptionManagementHelperUtil;
import io.entgra.device.mgt.core.application.mgt.core.util.subscription.mgt.service.SubscriptionManagementHelperService; import io.entgra.device.mgt.core.application.mgt.core.util.subscription.mgt.service.SubscriptionManagementHelperService;
import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.Device;
import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo;
import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException;
import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException;
import io.entgra.device.mgt.core.device.mgt.core.dto.GroupDetailsDTO; import io.entgra.device.mgt.core.device.mgt.core.dto.GroupDetailsDTO;
@ -197,8 +198,8 @@ public class GroupBasedSubscriptionManagementHelperServiceImpl implements Subscr
getAllDevicesOfGroup(subscriptionInfo.getIdentifier(), false); getAllDevicesOfGroup(subscriptionInfo.getIdentifier(), false);
List<Integer> removedIds = devices.stream() List<Integer> removedIds = devices.stream()
.filter(device -> { .filter(device -> {
String status = String.valueOf(device.getEnrolmentInfo().getStatus()); EnrolmentInfo.Status status = device.getEnrolmentInfo().getStatus();
return "REMOVED".equalsIgnoreCase(status) || "DELETED".equalsIgnoreCase(status); return status == EnrolmentInfo.Status.REMOVED || status == EnrolmentInfo.Status.DELETED;
}) })
.map(device -> device.getEnrolmentInfo().getId()).collect(Collectors.toList()); .map(device -> device.getEnrolmentInfo().getId()).collect(Collectors.toList());
List<Integer> enrollmentIdsOwnByGroup = devices.stream().map(device -> device.getEnrolmentInfo().getId()).collect(Collectors.toList()); List<Integer> enrollmentIdsOwnByGroup = devices.stream().map(device -> device.getEnrolmentInfo().getId()).collect(Collectors.toList());

Loading…
Cancel
Save