diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java index 44d915028..a82d66bde 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java @@ -152,7 +152,7 @@ public interface DeviceTypeConfigurationService { @ApiResponse( code = 200, message = "OK. \n Successfully fetched Android license configuration.", - response = PlatformConfiguration.class, + response = String.class, responseHeaders = { @ResponseHeader( name = "Content-Type", diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceTypeConfigurationServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceTypeConfigurationServiceImpl.java index effbd6876..c6b343215 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceTypeConfigurationServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceTypeConfigurationServiceImpl.java @@ -52,15 +52,15 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati public Response getConfiguration( @HeaderParam("If-Modified-Since") String ifModifiedSince) { String msg; - PlatformConfiguration PlatformConfiguration; + PlatformConfiguration platformConfiguration; List configs; try { - PlatformConfiguration = AndroidAPIUtils.getDeviceManagementService(). + platformConfiguration = AndroidAPIUtils.getDeviceManagementService(). getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - if (PlatformConfiguration != null) { - configs = PlatformConfiguration.getConfiguration(); + if (platformConfiguration != null) { + configs = platformConfiguration.getConfiguration(); } else { - PlatformConfiguration = new PlatformConfiguration(); + platformConfiguration = new PlatformConfiguration(); configs = new ArrayList<>(); } ConfigurationEntry entry = new ConfigurationEntry(); @@ -73,7 +73,7 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati entry.setName(AndroidConstants.TenantConfigProperties.LICENSE_KEY); entry.setValue(license.getText()); configs.add(entry); - PlatformConfiguration.setConfiguration(configs); + platformConfiguration.setConfiguration(configs); } } catch (DeviceManagementException e) { msg = "Error occurred while retrieving the Android tenant configuration"; @@ -81,14 +81,13 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati throw new UnexpectedServerErrorException( 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 @Override public Response updateConfiguration(@Valid AndroidPlatformConfiguration androidPlatformConfiguration) { String msg; - Message responseMsg = new Message(); ConfigurationEntry licenseEntry = null; PlatformConfiguration configuration = new PlatformConfiguration(); if (androidPlatformConfiguration == null) { @@ -120,16 +119,13 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati configuration.setConfiguration(configs); AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration); //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) { msg = "Error occurred while modifying configuration settings of Android platform"; log.error(msg, e); throw new UnexpectedServerErrorException( 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(); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java index 46315c203..f068b8884 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java @@ -123,17 +123,15 @@ public class AndroidAPIUtils { new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); } DeviceIdentifier deviceIdentifier; - List deviceids = new ArrayList<>(); + List deviceIdentifiers = new ArrayList<>(); for (String deviceId : deviceIDs) { deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(deviceId); deviceIdentifier.setType(AndroidConstants.DEVICE_TYPE_ANDROID); - deviceids.add(deviceIdentifier); + deviceIdentifiers.add(deviceIdentifier); } - Activity activity = null; - activity = getDeviceManagementService().addOperation( - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, operation, deviceids); - + Activity activity = getDeviceManagementService().addOperation( + DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, operation, deviceIdentifiers); // if (activity != null) { // GCMService gcmService = getGCMService(); // if (gcmService.isGCMEnabled()) { @@ -145,7 +143,6 @@ public class AndroidAPIUtils { // getGCMService().sendNotification(operation.getCode(), devices); // } // } - return Response.status(Response.Status.CREATED).entity(activity).build(); }