From c967fc34d03989ab7232aa22fbe59a6cc6be1e1b Mon Sep 17 00:00:00 2001 From: harshanl Date: Tue, 20 Sep 2016 18:43:50 +0530 Subject: [PATCH] Fixed EMM-1513 --- .../mgt/core/service/DeviceManagementProviderService.java | 1 - .../policy/mgt/core/mgt/impl/MonitoringManagerImpl.java | 4 ++-- .../wso2/carbon/policy/mgt/core/task/MonitoringTask.java | 6 ++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java index 06ae1c875f0..200291ce4c7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java @@ -23,7 +23,6 @@ import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; -import org.wso2.carbon.device.mgt.core.dto.DeviceType; import java.util.Date; import java.util.List; diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java index a80bd462194..adebb6ed389 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java @@ -399,7 +399,7 @@ public class MonitoringManagerImpl implements MonitoringManager { monitoringOperation.setCode(OPERATION_MONITOR); // CommandOperation infoOperation = new CommandOperation(); // infoOperation.setEnabled(true); -// infoOperation.setType(Operation.Type.COMMAND); +// infoOperation.setType(Operation.Type.COMMAND);\\ // infoOperation.setCode(OPERATION_INFO); // CommandOperation appListOperation = new CommandOperation(); // appListOperation.setEnabled(true); @@ -411,7 +411,7 @@ public class MonitoringManagerImpl implements MonitoringManager { if (deviceIdentifiers.size() > 0) { type = deviceIdentifiers.get(0).getType(); } - DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); + DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService(); service.addOperation(type, monitoringOperation, deviceIdentifiers); // service.addOperation(infoOperation, deviceIdentifiers); // service.addOperation(appListOperation, deviceIdentifiers); 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 cf803dec283..09987a5d19e 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 @@ -117,8 +117,10 @@ public class MonitoringTask implements Task { log.debug(device.getDeviceIdentifier()); } } - monitoringManager.addMonitoringOperation(notifiableDevices); - monitoringService.notifyDevices(notifiableDevices); + if (!notifiableDevices.isEmpty()) { + monitoringManager.addMonitoringOperation(notifiableDevices); + monitoringService.notifyDevices(notifiableDevices); + } } } if (log.isDebugEnabled()) {