From 7dd48bf00efb3121ebcdf7c4a604b016c8c881f1 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Wed, 2 Sep 2015 19:39:50 +0530 Subject: [PATCH] Fixing the monitoring task for INACTIVE, BLOCKED, REMOVED, UNCLAIMED, DISENROLLMENT_REQUESTED, SUSPENDED devices --- .../policy/mgt/core/task/MonitoringTask.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java index cff114bf40..2fd0a5b07e 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java @@ -77,14 +77,13 @@ public class MonitoringTask implements Task { try { - DeviceManagementProviderService deviceManagementProviderService = PolicyManagementDataHolder.getInstance().getDeviceManagementService(); for (DeviceType deviceType : deviceTypes) { - if(log.isDebugEnabled()){ - log.debug("Running task for device type : " + deviceType.getName() ); + if (log.isDebugEnabled()) { + log.debug("Running task for device type : " + deviceType.getName()); } PolicyMonitoringService monitoringService = @@ -100,15 +99,21 @@ public class MonitoringTask implements Task { deviceType.getName()); } for (Device device : devices) { - if (device.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.INACTIVE) || - device.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.BLOCKED)) { + EnrolmentInfo.Status status = device.getEnrolmentInfo().getStatus(); + if (status.equals(EnrolmentInfo.Status.INACTIVE) || + status.equals(EnrolmentInfo.Status.BLOCKED) || + status.equals(EnrolmentInfo.Status.REMOVED) || + status.equals(EnrolmentInfo.Status.UNCLAIMED) || + status.equals(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED) || + status.equals(EnrolmentInfo.Status.SUSPENDED)) { continue; } else { notifiableDevices.add(device); } } if (log.isDebugEnabled()) { - log.debug("Following devices selected to send the notification for " + deviceType.getName()); + log.debug("Following devices selected to send the notification for " + + deviceType.getName()); for (Device device : notifiableDevices) { log.debug(device.getDeviceIdentifier()); }