From 952db0183decc7f51ffe559a3bdd1016822c9305 Mon Sep 17 00:00:00 2001 From: harshanl Date: Fri, 3 Jul 2015 18:13:02 +0530 Subject: [PATCH] Moved updateApplicationListOfDevice method to DeviceMgtService --- .../mgt/ApplicationManagementProviderService.java | 7 ------- .../ApplicationManagerProviderServiceImpl.java | 15 --------------- .../service/DeviceManagementProviderService.java | 12 ++++++++++++ .../DeviceManagementProviderServiceImpl.java | 15 +++++++++++++++ 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/api/mgt/ApplicationManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/api/mgt/ApplicationManagementProviderService.java index 12e9cf74b0..7ed2af3ba6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/api/mgt/ApplicationManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/api/mgt/ApplicationManagementProviderService.java @@ -1,14 +1,7 @@ package org.wso2.carbon.device.mgt.core.api.mgt; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.common.app.mgt.Application; -import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; -import java.util.List; - public interface ApplicationManagementProviderService extends ApplicationManager { - void updateApplicationListInstallInDevice(DeviceIdentifier deviceIdentifier, List applications) - throws ApplicationManagementException; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java index 2034ea61dd..c51429b773 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java @@ -159,21 +159,6 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem return pluginRepository; } - @Override - public void updateApplicationListInstallInDevice(DeviceIdentifier deviceIdentifier,List applications) - throws ApplicationManagementException { - - int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); - try { - Device device = deviceDAO.getDevice(deviceIdentifier, tenantId); - deviceDAO.addDeviceApplications(device.getId(), applications); - }catch (DeviceManagementDAOException deviceDaoEx){ - String errorMsg = "Error occurred saving application list to the device"; - log.error(errorMsg+":"+deviceIdentifier.toString()); - throw new ApplicationManagementException(errorMsg, deviceDaoEx); - } - } - @Override public void registerDeviceManagementService(DeviceManagementService deviceManagementService) { try { 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 ba8fd26d59..fbe5dfd957 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 @@ -87,5 +87,17 @@ public interface DeviceManagementProviderService extends DeviceManager, LicenseM */ List getApplicationListForDevice(DeviceIdentifier deviceIdentifier) throws DeviceManagementException; + + /** + * The method to get application list installed for the device. + * + * @param deviceIdentifier device identifier of the device + * @param applications List of installed Applications + * + * @throws DeviceManagementException + */ + void updateInstalledApplicationListOfDevice(DeviceIdentifier deviceIdentifier, List applications) + throws DeviceManagementException; + void updateDeviceEnrolmentInfo(Device device, EnrolmentInfo.Status active) throws DeviceManagementException; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 09c090e117..cc74de3e89 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -659,6 +659,21 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } } + @Override + public void updateInstalledApplicationListOfDevice(DeviceIdentifier deviceIdentifier, + List applications) + throws DeviceManagementException { + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + try { + Device device = deviceDAO.getDevice(deviceIdentifier, tenantId); + deviceDAO.addDeviceApplications(device.getId(), applications); + }catch (DeviceManagementDAOException deviceDaoEx){ + String errorMsg = "Error occurred saving application list to the device"; + log.error(errorMsg+":"+deviceIdentifier.toString()); + throw new DeviceManagementException(errorMsg, deviceDaoEx); + } + } + @Override public void updateDeviceEnrolmentInfo(Device device, EnrolmentInfo.Status status) throws DeviceManagementException {