code formatting

revert-dabc3590
Nirothipan 7 years ago
parent 8ce3b6a8c3
commit a90658b5e7

@ -72,4 +72,3 @@ public class FileTransfer extends AndroidOperation implements Serializable {
this.ftpPassword = ftpPassword; this.ftpPassword = ftpPassword;
} }
} }

@ -31,6 +31,7 @@ public class FileTransferBeanWrapper{
@ApiModelProperty(name = "deviceIDs", value = "Device id list of the operation to be executed.", required = true) @ApiModelProperty(name = "deviceIDs", value = "Device id list of the operation to be executed.", required = true)
private List<String> deviceIDs; private List<String> deviceIDs;
@ApiModelProperty(name = "operation", value = "Information of the Device lock operation.", required = true) @ApiModelProperty(name = "operation", value = "Information of the Device lock operation.", required = true)
private FileTransfer operation; private FileTransfer operation;

@ -227,7 +227,6 @@ import java.util.List;
) )
public interface DeviceManagementAdminService { public interface DeviceManagementAdminService {
///////////////////////
@POST @POST
@Path("/file-transfer") @Path("/file-transfer")
@ApiOperation( @ApiOperation(
@ -237,7 +236,6 @@ public interface DeviceManagementAdminService {
value = "Adding a Screen Lock on Android devices", 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 " + 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.", "permanently locks the device or screen locking an Android device.",
////
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service", tags = "Android Device Management Administrative Service",
extensions = { extensions = {
@ -295,7 +293,6 @@ public interface DeviceManagementAdminService {
"Multiple device IDs can be added by using comma separated values. ", "Multiple device IDs can be added by using comma separated values. ",
required = true) FileTransferBeanWrapper fileTransferBeanWrapper); required = true) FileTransferBeanWrapper fileTransferBeanWrapper);
////////////////////////////////////
@POST @POST
@Path("/lock-devices") @Path("/lock-devices")
@ApiOperation( @ApiOperation(

@ -73,49 +73,47 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
private static final Log log = LogFactory.getLog(DeviceManagementAdminServiceImpl.class); private static final Log log = LogFactory.getLog(DeviceManagementAdminServiceImpl.class);
private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ"; 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 { @POST
if (fileTransferBeanWrapper == null || fileTransferBeanWrapper.getOperation() == null) { @Path("/file-transfer")
String errorMessage = "Lock bean is empty."; @Override
log.error(errorMessage); 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( throw new BadRequestException(
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); 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 @POST
@Path("/lock-devices") @Path("/lock-devices")
@Override @Override

Loading…
Cancel
Save