From 0609b3a9c2f6b48975bbccd33bdae77ead491ec9 Mon Sep 17 00:00:00 2001 From: ruwin Date: Wed, 11 Sep 2024 07:21:33 +0530 Subject: [PATCH] Used constants instead of hardcoding --- .../GroupBasedSubscriptionManagementHelperServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 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/util/subscription/mgt/impl/GroupBasedSubscriptionManagementHelperServiceImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/GroupBasedSubscriptionManagementHelperServiceImpl.java index d67706e575..9b5dc445de 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/GroupBasedSubscriptionManagementHelperServiceImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/GroupBasedSubscriptionManagementHelperServiceImpl.java @@ -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.service.SubscriptionManagementHelperService; 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.group.mgt.GroupManagementException; import io.entgra.device.mgt.core.device.mgt.core.dto.GroupDetailsDTO; @@ -197,8 +198,8 @@ public class GroupBasedSubscriptionManagementHelperServiceImpl implements Subscr getAllDevicesOfGroup(subscriptionInfo.getIdentifier(), false); List removedIds = devices.stream() .filter(device -> { - String status = String.valueOf(device.getEnrolmentInfo().getStatus()); - return "REMOVED".equalsIgnoreCase(status) || "DELETED".equalsIgnoreCase(status); + EnrolmentInfo.Status status = device.getEnrolmentInfo().getStatus(); + return status == EnrolmentInfo.Status.REMOVED || status == EnrolmentInfo.Status.DELETED; }) .map(device -> device.getEnrolmentInfo().getId()).collect(Collectors.toList()); List enrollmentIdsOwnByGroup = devices.stream().map(device -> device.getEnrolmentInfo().getId()).collect(Collectors.toList());