From cff69459bed7fda04bb4f41b310c5aa561cc2d50 Mon Sep 17 00:00:00 2001 From: Nirothipan Date: Thu, 21 Sep 2017 17:18:57 +0530 Subject: [PATCH] code formatting and updating comments, descriptions --- .../services/android/bean/FileTransfer.java | 1 - .../DeviceManagementAdminService.java | 7 ++++--- .../DeviceManagementAdminServiceImpl.java | 21 +++++++++---------- .../public/js/operation-bar.js | 5 +++++ 4 files changed, 19 insertions(+), 15 deletions(-) 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/bean/FileTransfer.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/FileTransfer.java index e4488952d0..0ecf3d4fe6 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/FileTransfer.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/FileTransfer.java @@ -47,7 +47,6 @@ public class FileTransfer extends AndroidOperation implements Serializable { this.fileURL = fileURL; } - public String getFtpPassword() { return ftpPassword; } 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/DeviceManagementAdminService.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/DeviceManagementAdminService.java index 90fd3e877d..c8bd68d9ca 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/DeviceManagementAdminService.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/DeviceManagementAdminService.java @@ -233,7 +233,8 @@ public interface DeviceManagementAdminService { consumes = MediaType.APPLICATION_JSON, httpMethod = "POST", value = "Transferring file to the device.", - notes = "Using this API you have the option to transfer a file from FTP server to an Android device.", + notes = "Using this API you have the option to transfer a file from SFTP/FTP server or using an " + + "HTTP link to the device or retrieve file from the device to FTP/SFTP server .", response = Activity.class, tags = "Android Device Management Administrative Service", extensions = { @@ -245,7 +246,6 @@ public interface DeviceManagementAdminService { @ApiResponses(value = { @ApiResponse( code = 201, - //todo message = "File transferred.", response = Activity.class, responseHeaders = { @@ -284,7 +284,8 @@ public interface DeviceManagementAdminService { Response fileTransfer( @ApiParam( name = "fileTransfer", - value = "Provide the ID of the Android device. Multiple device IDs can be added by using comma separated values.", + value = "Provide the ID of the Android device. Multiple device IDs can be added by using " + + "comma separated values.", required = true) FileTransferBeanWrapper fileTransferBeanWrapper); @POST 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/DeviceManagementAdminServiceImpl.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/DeviceManagementAdminServiceImpl.java index 7974f00cbb..6fa0d1fd2a 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/DeviceManagementAdminServiceImpl.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/DeviceManagementAdminServiceImpl.java @@ -94,17 +94,16 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe @Path("/file-transfer") @Override public Response fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) { - if (log.isDebugEnabled()) { - log.debug("Invoking Android file transfer operation for " + fileTransferBeanWrapper.getDeviceIDs()); - } - - try { - if (fileTransferBeanWrapper == null || fileTransferBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the file transfer operation is incorrect."; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } + try { + if (fileTransferBeanWrapper == null || fileTransferBeanWrapper.getOperation() == null) { + String errorMessage = "The payload of the file transfer operation is incorrect."; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + if (fileTransferBeanWrapper.getDeviceIDs() != null && log.isDebugEnabled()) { + log.debug("Invoking Android file transfer operation for " + fileTransferBeanWrapper.getDeviceIDs()); + } FileTransfer file = fileTransferBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); if (fileTransferBeanWrapper.isUpload()) { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/js/operation-bar.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/js/operation-bar.js index aebf833f05..ea8c424da3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/js/operation-bar.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/js/operation-bar.js @@ -32,6 +32,11 @@ var resetLoader = function () { $('#lbl-execution').addClass("hidden"); }; +/** + * This changes the text box label when the operation is toggled between FILE UPLOAD and FILE DOWNLOAD + * and shows an info label for FILE UPLOAD regarding saving location. + * @param type + */ function changeLabel(type) { $(".modal #operation-error-msg").addClass("hidden"); if (type == "no") {