From a90658b5e7443121b845c1575bb25e3138901ddb Mon Sep 17 00:00:00 2001 From: Nirothipan Date: Thu, 24 Aug 2017 12:29:09 +0530 Subject: [PATCH] code formatting --- .../android/bean/wrapper/FileTransfer.java | 1 - .../bean/wrapper/FileTransferBeanWrapper.java | 1 + .../DeviceManagementAdminService.java | 3 - .../DeviceManagementAdminServiceImpl.java | 72 +++++++++---------- 4 files changed, 36 insertions(+), 41 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 9aa5b5fa02..099cd8d86b 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 @@ -72,4 +72,3 @@ public class FileTransfer extends AndroidOperation implements Serializable { this.ftpPassword = 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/bean/wrapper/FileTransferBeanWrapper.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/FileTransferBeanWrapper.java index 8fe429e1cf..64ce960fab 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/FileTransferBeanWrapper.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/FileTransferBeanWrapper.java @@ -31,6 +31,7 @@ public class FileTransferBeanWrapper{ @ApiModelProperty(name = "deviceIDs", value = "Device id list of the operation to be executed.", required = true) private List deviceIDs; + @ApiModelProperty(name = "operation", value = "Information of the Device lock operation.", required = true) private FileTransfer operation; 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 0a510418d7..f745c24895 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 @@ -227,7 +227,6 @@ import java.util.List; ) public interface DeviceManagementAdminService { - /////////////////////// @POST @Path("/file-transfer") @ApiOperation( @@ -237,7 +236,6 @@ public interface DeviceManagementAdminService { value = "Adding a Screen Lock on Android devices", notes = "Using this API you have the option of hard locking an Android device, where the Administrator " + "permanently locks the device or screen locking an Android device.", - //// response = Activity.class, tags = "Android Device Management Administrative Service", extensions = { @@ -295,7 +293,6 @@ public interface DeviceManagementAdminService { "Multiple device IDs can be added by using comma separated values. ", required = true) FileTransferBeanWrapper fileTransferBeanWrapper); - //////////////////////////////////// @POST @Path("/lock-devices") @ApiOperation( 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 3d2f961851..d497e51bb4 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 @@ -73,49 +73,47 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe private static final Log log = LogFactory.getLog(DeviceManagementAdminServiceImpl.class); private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ"; -///////////////////////////////////////////////////////////////////////////////////// -@POST -@Path("/file-transfer") -@Override -public Response fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) { - if (log.isDebugEnabled()) { - log.debug("Invoking Android device lock operation"); - } - try { - if (fileTransferBeanWrapper == null || fileTransferBeanWrapper.getOperation() == null) { - String errorMessage = "Lock bean is empty."; - log.error(errorMessage); + @POST + @Path("/file-transfer") + @Override + public Response fileTransfer(FileTransferBeanWrapper fileTransferBeanWrapper) { + if (log.isDebugEnabled()) { + log.debug("Invoking Android file transfer operation"); + } + + try { + if (fileTransferBeanWrapper == null || fileTransferBeanWrapper.getOperation() == null) { + String errorMessage = "Lock bean is empty."; + log.error(errorMessage); + throw new BadRequestException( + new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } + FileTransfer file = fileTransferBeanWrapper.getOperation(); + ProfileOperation operation = new ProfileOperation(); + operation.setCode("FILE_TRANSFER"); + operation.setType(Operation.Type.PROFILE); + operation.setEnabled(true); + operation.setPayLoad(file.toJSON()); + return AndroidAPIUtils.getOperationResponse(fileTransferBeanWrapper.getDeviceIDs(), operation); + } catch (InvalidDeviceException e) { + String errorMessage = "Invalid Device Identifiers found."; + log.error(errorMessage, e); throw new BadRequestException( new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + } catch (OperationManagementException e) { + String errorMessage = "Issue in retrieving operation management service instance"; + log.error(errorMessage, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); + } catch (DeviceManagementException e) { + String errorMessage = "Issue in retrieving device management service instance"; + log.error(errorMessage, e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); } - FileTransfer file = fileTransferBeanWrapper.getOperation(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode("FILE_TRANSFER"); - operation.setType(Operation.Type.PROFILE); - operation.setEnabled(true); - operation.setPayLoad(file.toJSON()); - return AndroidAPIUtils.getOperationResponse(fileTransferBeanWrapper.getDeviceIDs(), operation); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } catch (OperationManagementException e) { - String errorMessage = "Issue in retrieving operation management service instance"; - log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); - } catch (DeviceManagementException e) { - String errorMessage = "Issue in retrieving device management service instance"; - log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); } -} - - /////////////////////////////////////////////////////////// @POST @Path("/lock-devices") @Override