From 7ed6552a57a869833540e27d0488cbdd2ed802d6 Mon Sep 17 00:00:00 2001 From: Nirothipan Date: Tue, 22 Aug 2017 11:25:48 +0530 Subject: [PATCH] adding form parameters --- .../android/bean/wrapper/FileTransfer.java | 36 +++++++++--- .../DeviceManagementAdminService.java | 57 ++++++++++--------- .../DeviceManagementAdminServiceImpl.java | 2 +- 3 files changed, 59 insertions(+), 36 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/wrapper/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/wrapper/FileTransfer.java index 7cca854a05..34c0baf41f 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/wrapper/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/wrapper/FileTransfer.java @@ -25,19 +25,41 @@ import java.io.Serializable; @ApiModel(value = "FileTransfer", - description = "This class carries all information related to device lock operation.") + //todo + description = "This class carries all information related to file transfer operation.") public class FileTransfer extends AndroidOperation implements Serializable { //todo - @ApiModelProperty(name = "message", value = "Pop up message of the lock operation.", required = false) - private String message; - @ApiModelProperty(name = "isHardLockEnabled", value = "Hard lock enable status of the Device", required = true) + @ApiModelProperty(name = "file-location", value = "FTP URL of file", required = true) + private String location; + + @ApiModelProperty(name = "ftp-username", value = "FTP User name", required = true) + private String userName; + + @ApiModelProperty(name = "ftp-password", value = "FTP password", required = true) + private String password; public String getFielLocation() { - return message; + return location; + } + + public void setFileLocation(String location) { + this.location = location; + } + + public String getFtpUserName() { + return userName; + } + + public void setFtpUserName(String userName) { + this.userName = userName; + } + + public String getFtpPassword() { + return password; } - public void setFileLocation(String message) { - this.message = message; + public void setFtpPassword(String password) { + this.password = password; } 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 2a653b22ce..0a510418d7 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 @@ -294,7 +294,8 @@ public interface DeviceManagementAdminService { "screen lock the device." + "Multiple device IDs can be added by using comma separated values. ", required = true) FileTransferBeanWrapper fileTransferBeanWrapper); -//////////////////////////////////// + + //////////////////////////////////// @POST @Path("/lock-devices") @ApiOperation( @@ -417,7 +418,7 @@ public interface DeviceManagementAdminService { name = "deviceIDs", value = "Provide the ID of the Android device. Multiple device IDs can be added by using comma separated values. ", required = true) - List deviceIDs); + List deviceIDs); @POST @@ -479,7 +480,7 @@ public interface DeviceManagementAdminService { name = "deviceIDs", value = "Provide the ID of the Android device. Multiple device IDs can be added by using comma separated values. ", required = true) - List deviceIDs); + List deviceIDs); @POST @Path("/clear-password") @@ -537,7 +538,7 @@ public interface DeviceManagementAdminService { Response removePassword( @ApiParam(name = "deviceIDs", value = "Provide the ID of the Android device. Multiple device IDs can be added by using comma separated values. ", - required = true) List deviceIDs); + required = true) List deviceIDs); @POST @Path("/control-camera") @@ -552,7 +553,7 @@ public interface DeviceManagementAdminService { @Extension(properties = { @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:control-camera") }) - } ) + }) @ApiResponses(value = { @ApiResponse( code = 201, @@ -599,7 +600,7 @@ public interface DeviceManagementAdminService { "camera on the device to function by defining false as the value and the ID of the Android device. " + "Multiple device IDs can be added by using comma separated values. ", required = true) - CameraBeanWrapper cameraBeanWrapper); + CameraBeanWrapper cameraBeanWrapper); @POST @Path("/info") @@ -662,7 +663,7 @@ public interface DeviceManagementAdminService { name = "deviceIds", value = "Provide the device ID of the Android device. Multiple device IDs can be added by using comma separated values.", required = true) - List deviceIDs); + List deviceIDs); @POST @Path("/logcat") @@ -697,11 +698,11 @@ public interface DeviceManagementAdminService { @ResponseHeader( name = "ETag", description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), + "Used by caches, or in conditional requests."), @ResponseHeader( name = "Last-Modified", description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.")}), + "Used by caches, or in conditional requests.")}), @ApiResponse( code = 303, message = "See Other. \n The source can be retrieved from the URL specified in the location header.", @@ -718,7 +719,7 @@ public interface DeviceManagementAdminService { @ApiResponse( code = 500, message = "Internal Server Error. \n " + - "Server error occurred while adding a new device logcat operation.") + "Server error occurred while adding a new device logcat operation.") }) Response getDeviceLogcat( @ApiParam( @@ -786,7 +787,7 @@ public interface DeviceManagementAdminService { name = "deviceIDs", value = "Provide the ID of the Android device. Multiple device IDs can be added by using comma separated values. ", required = true) - List deviceIDs); + List deviceIDs); @POST @Path("/wipe") @@ -847,7 +848,7 @@ public interface DeviceManagementAdminService { value = "Provide the the passcode, which is the passcode that the Android agent prompts the device owner to set at the time of device enrollment, " + "to enable the factory reset operation, and the ID of the Android device. Multiple device IDs can be added by using comma separated values. ", required = true) - WipeDataBeanWrapper wipeDataBeanWrapper); + WipeDataBeanWrapper wipeDataBeanWrapper); @POST @Path("/applications") @@ -909,9 +910,9 @@ public interface DeviceManagementAdminService { Response getApplications( @ApiParam( name = "deviceIDs", - value = "Provide the ID of the Android device. Multiple device IDs can be added using comma separated values." , + value = "Provide the ID of the Android device. Multiple device IDs can be added using comma separated values.", required = true) - List deviceIDs); + List deviceIDs); @POST @Path("/ring") @@ -971,7 +972,7 @@ public interface DeviceManagementAdminService { name = "deviceIDs", value = "Provide the ID of the Android device. Multiple device IDs can be added using comma separated values.", required = true) - List deviceIDs); + List deviceIDs); @POST @Path("/reboot") @@ -1031,7 +1032,7 @@ public interface DeviceManagementAdminService { name = "deviceIDs", value = "Provide the ID of the Android device. Multiple device IDs can be added using comma separated values. ", required = true) - List deviceIDs); + List deviceIDs); @POST @Path("/mute") @@ -1091,7 +1092,7 @@ public interface DeviceManagementAdminService { name = "deviceIDs", value = "Provide the ID of the Android device. Multiple device IDs can be added using comma separated values. ", required = true) - List deviceIDs); + List deviceIDs); @POST @Path("/install-application") @@ -1155,7 +1156,7 @@ public interface DeviceManagementAdminService { " URL and name of the application, the date and time for the scheduled installation, and the ID of the " + "Android device. Multiple device IDs can be added by using comma separated values.", required = true) - ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper); + ApplicationInstallationBeanWrapper applicationInstallationBeanWrapper); @POST @Path("/update-application") @@ -1220,7 +1221,7 @@ public interface DeviceManagementAdminService { "URL and name of the application, the date and time for the scheduled installation, and the ID of the" + "Android device. Multiple device IDs can be added by using comma separated values.", required = true) - ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper); + ApplicationUpdateBeanWrapper applicationUpdateBeanWrapper); @POST @Path("/uninstall-application") @@ -1282,7 +1283,7 @@ public interface DeviceManagementAdminService { "URL and name of the application, the date and time for the scheduled installation, and the ID of the" + "Android device. Multiple device IDs can be added by using comma separated values.", required = true) - ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper); + ApplicationUninstallationBeanWrapper applicationUninstallationBeanWrapper); @POST @Path("/blacklist-applications") @@ -1411,7 +1412,7 @@ public interface DeviceManagementAdminService { "(example: http//abc.com, http://abc.com/ota), " + "and the ID of the Android device. Multiple device IDs can be added by using comma separated values.", required = true) - UpgradeFirmwareBeanWrapper upgradeFirmwareBeanWrapper); + UpgradeFirmwareBeanWrapper upgradeFirmwareBeanWrapper); @POST @Path("/configure-vpn") @@ -1472,7 +1473,7 @@ public interface DeviceManagementAdminService { name = "vpnBean", value = "VPN configuration and DeviceIds", required = true) - VpnBeanWrapper vpnBeanWrapper); + VpnBeanWrapper vpnBeanWrapper); @POST @Path("/send-notification") @@ -1533,7 +1534,7 @@ public interface DeviceManagementAdminService { value = "The properties required to send a notification. Provide the message you wish to send and the ID of the " + "Android device. Multiple device IDs can be added by using comma separated values.", required = true) - NotificationBeanWrapper notificationBeanWrapper); + NotificationBeanWrapper notificationBeanWrapper); @POST @Path("/configure-wifi") @@ -1595,7 +1596,7 @@ public interface DeviceManagementAdminService { "the ssid or the name of the Wi-Fi network that you wish to configure and the ID of the Android device." + " Multiple device IDs can be added by using comma separated values.", required = true) - WifiBeanWrapper wifiBeanWrapper); + WifiBeanWrapper wifiBeanWrapper); @POST @Path("/encrypt-storage") @@ -1657,7 +1658,7 @@ public interface DeviceManagementAdminService { "true as the value or do not encrypt the storage on the device by assigning false as the value and " + "provide the ID of the Android device. Multiple device IDs can be added by using comma separated values.", required = true) - EncryptionBeanWrapper encryptionBeanWrapper); + EncryptionBeanWrapper encryptionBeanWrapper); @POST @Path("/change-lock-code") @@ -1719,7 +1720,7 @@ public interface DeviceManagementAdminService { "the ID of the Android device. Multiple device IDs can be added by using comma separated values. " + "If a passcode policy has been set in EMM, the lock code should comply to the passcode policy.\t", required = true) - LockCodeBeanWrapper lockCodeBeanWrapper); + LockCodeBeanWrapper lockCodeBeanWrapper); @POST @Path("/set-password-policy") @@ -1779,7 +1780,7 @@ public interface DeviceManagementAdminService { name = "passwordPolicy", value = "The properties required to set a password policy.", required = true) - PasswordPolicyBeanWrapper passwordPolicyBeanWrapper); + PasswordPolicyBeanWrapper passwordPolicyBeanWrapper); @POST @Path("/set-webclip") @@ -1839,7 +1840,7 @@ public interface DeviceManagementAdminService { name = "webClip", value = "The properties to set the web clip.", required = true) - WebClipBeanWrapper webClipBeanWrapper); + WebClipBeanWrapper webClipBeanWrapper); } 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 537b543726..3d2f961851 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 @@ -91,7 +91,7 @@ public Response fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) { } FileTransfer file = fileTransferBeanWrapper.getOperation(); ProfileOperation operation = new ProfileOperation(); - operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCK); + operation.setCode("FILE_TRANSFER"); operation.setType(Operation.Type.PROFILE); operation.setEnabled(true); operation.setPayLoad(file.toJSON());