Moved updateApplicationListOfDevice method to DeviceMgtService

revert-70aa11f8
harshanl 9 years ago
parent 8c59d82708
commit 952db0183d

@ -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<Application> applications)
throws ApplicationManagementException;
}

@ -159,21 +159,6 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
return pluginRepository;
}
@Override
public void updateApplicationListInstallInDevice(DeviceIdentifier deviceIdentifier,List<Application> 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 {

@ -87,5 +87,17 @@ public interface DeviceManagementProviderService extends DeviceManager, LicenseM
*/
List<Application> 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<Application> applications)
throws DeviceManagementException;
void updateDeviceEnrolmentInfo(Device device, EnrolmentInfo.Status active) throws DeviceManagementException;
}

@ -659,6 +659,21 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
}
}
@Override
public void updateInstalledApplicationListOfDevice(DeviceIdentifier deviceIdentifier,
List<Application> 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 {

Loading…
Cancel
Save