|
|
@ -52,15 +52,15 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
|
|
|
public Response getConfiguration(
|
|
|
|
public Response getConfiguration(
|
|
|
|
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
|
|
|
|
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
|
|
|
|
String msg;
|
|
|
|
String msg;
|
|
|
|
PlatformConfiguration PlatformConfiguration;
|
|
|
|
PlatformConfiguration platformConfiguration;
|
|
|
|
List<ConfigurationEntry> configs;
|
|
|
|
List<ConfigurationEntry> configs;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
PlatformConfiguration = AndroidAPIUtils.getDeviceManagementService().
|
|
|
|
platformConfiguration = AndroidAPIUtils.getDeviceManagementService().
|
|
|
|
getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
|
|
|
getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
|
|
|
if (PlatformConfiguration != null) {
|
|
|
|
if (platformConfiguration != null) {
|
|
|
|
configs = PlatformConfiguration.getConfiguration();
|
|
|
|
configs = platformConfiguration.getConfiguration();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
PlatformConfiguration = new PlatformConfiguration();
|
|
|
|
platformConfiguration = new PlatformConfiguration();
|
|
|
|
configs = new ArrayList<>();
|
|
|
|
configs = new ArrayList<>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ConfigurationEntry entry = new ConfigurationEntry();
|
|
|
|
ConfigurationEntry entry = new ConfigurationEntry();
|
|
|
@ -73,7 +73,7 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
|
|
|
entry.setName(AndroidConstants.TenantConfigProperties.LICENSE_KEY);
|
|
|
|
entry.setName(AndroidConstants.TenantConfigProperties.LICENSE_KEY);
|
|
|
|
entry.setValue(license.getText());
|
|
|
|
entry.setValue(license.getText());
|
|
|
|
configs.add(entry);
|
|
|
|
configs.add(entry);
|
|
|
|
PlatformConfiguration.setConfiguration(configs);
|
|
|
|
platformConfiguration.setConfiguration(configs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
msg = "Error occurred while retrieving the Android tenant configuration";
|
|
|
|
msg = "Error occurred while retrieving the Android tenant configuration";
|
|
|
@ -81,14 +81,13 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
|
|
|
throw new UnexpectedServerErrorException(
|
|
|
|
throw new UnexpectedServerErrorException(
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Response.status(Response.Status.OK).entity(PlatformConfiguration).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(platformConfiguration).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PUT
|
|
|
|
@PUT
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Response updateConfiguration(@Valid AndroidPlatformConfiguration androidPlatformConfiguration) {
|
|
|
|
public Response updateConfiguration(@Valid AndroidPlatformConfiguration androidPlatformConfiguration) {
|
|
|
|
String msg;
|
|
|
|
String msg;
|
|
|
|
Message responseMsg = new Message();
|
|
|
|
|
|
|
|
ConfigurationEntry licenseEntry = null;
|
|
|
|
ConfigurationEntry licenseEntry = null;
|
|
|
|
PlatformConfiguration configuration = new PlatformConfiguration();
|
|
|
|
PlatformConfiguration configuration = new PlatformConfiguration();
|
|
|
|
if (androidPlatformConfiguration == null) {
|
|
|
|
if (androidPlatformConfiguration == null) {
|
|
|
@ -120,16 +119,13 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
|
|
|
configuration.setConfiguration(configs);
|
|
|
|
configuration.setConfiguration(configs);
|
|
|
|
AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
|
|
|
|
AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
|
|
|
|
//AndroidAPIUtils.getGCMService().resetTenantConfigCache();
|
|
|
|
//AndroidAPIUtils.getGCMService().resetTenantConfigCache();
|
|
|
|
Response.status(Response.Status.ACCEPTED);
|
|
|
|
|
|
|
|
responseMsg.setResponseMessage("Android platform configuration has been updated successfully.");
|
|
|
|
|
|
|
|
responseMsg.setResponseCode(Response.Status.ACCEPTED.toString());
|
|
|
|
|
|
|
|
} 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);
|
|
|
|
throw new UnexpectedServerErrorException(
|
|
|
|
throw new UnexpectedServerErrorException(
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Response.status(Response.Status.CREATED).entity(responseMsg).build();
|
|
|
|
return Response.status(Response.Status.OK).entity("Android platform configuration has been updated successfully.").build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|