|
|
@ -20,7 +20,11 @@ package org.wso2.carbon.mdm.services.android.services.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.wso2.carbon.device.mgt.common.*;
|
|
|
|
import org.wso2.carbon.device.mgt.common.Device;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.InvalidDeviceException;
|
|
|
|
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
|
|
|
|
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
|
|
|
|
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
|
|
|
|
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
|
|
|
|
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
|
|
|
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
|
|
@ -125,6 +129,7 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
|
|
|
for (Device device : deviceList) {
|
|
|
|
for (Device device : deviceList) {
|
|
|
|
deviceIdList.add(new DeviceIdentifier(device.getDeviceIdentifier(),device.getType()));
|
|
|
|
deviceIdList.add(new DeviceIdentifier(device.getDeviceIdentifier(),device.getType()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (entry.getValue() != null) {
|
|
|
|
NotifierFrequency notifierFrequency = new NotifierFrequency();
|
|
|
|
NotifierFrequency notifierFrequency = new NotifierFrequency();
|
|
|
|
notifierFrequency.setValue(Integer.parseInt(entry.getValue().toString()));
|
|
|
|
notifierFrequency.setValue(Integer.parseInt(entry.getValue().toString()));
|
|
|
|
ProfileOperation operation = new ProfileOperation();
|
|
|
|
ProfileOperation operation = new ProfileOperation();
|
|
|
@ -135,6 +140,10 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
|
|
|
AndroidAPIUtils.getDeviceManagementService().addOperation(
|
|
|
|
AndroidAPIUtils.getDeviceManagementService().addOperation(
|
|
|
|
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID,
|
|
|
|
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID,
|
|
|
|
operation, deviceIdList);
|
|
|
|
operation, deviceIdList);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST)
|
|
|
|
|
|
|
|
.entity("No value specified for notifierFrequency.").build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -143,7 +152,6 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
|
|
|
}
|
|
|
|
}
|
|
|
|
configuration.setConfiguration(configs);
|
|
|
|
configuration.setConfiguration(configs);
|
|
|
|
AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
|
|
|
|
AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
|
|
|
|
//AndroidAPIUtils.getGCMService().resetTenantConfigCache();
|
|
|
|
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
msg = "Error occurred while modifying configuration settings of Android platform";
|
|
|
|
msg = "Error occurred while modifying configuration settings of Android platform";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
@ -154,11 +162,6 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
throw new UnexpectedServerErrorException(
|
|
|
|
throw new UnexpectedServerErrorException(
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
|
|
|
|
} catch (NullPointerException e) {
|
|
|
|
|
|
|
|
msg = "Error occurred while reading notifierFrequency value.";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new UnexpectedServerErrorException(
|
|
|
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
|
|
|
|
|
|
|
|
} catch (OperationManagementException e) {
|
|
|
|
} catch (OperationManagementException e) {
|
|
|
|
msg = "Error occurred while modifying configuration settings of Android platform.";
|
|
|
|
msg = "Error occurred while modifying configuration settings of Android platform.";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|