|
|
|
@ -35,6 +35,7 @@
|
|
|
|
|
*/
|
|
|
|
|
package org.wso2.carbon.device.mgt.mobile.android.api.impl;
|
|
|
|
|
|
|
|
|
|
import com.google.api.client.http.HttpStatusCodes;
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
|
import org.apache.http.HttpStatus;
|
|
|
|
@ -86,7 +87,9 @@ import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.VpnBeanWrap
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WebClipBeanWrapper;
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WifiBeanWrapper;
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.android.common.bean.wrapper.WipeDataBeanWrapper;
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.android.common.exception.AndroidDeviceMgtPluginException;
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestException;
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.android.common.exception.BadRequestExceptionDup;
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.android.common.exception.UnexpectedServerErrorException;
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.android.common.spi.AndroidService;
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.android.core.util.AndroidAPIUtils;
|
|
|
|
@ -127,8 +130,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} catch (OperationManagementException e) {
|
|
|
|
|
String errorMessage = "Issue in retrieving operation management service instance for file transfer operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
throw new UnexpectedServerErrorException(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e) {
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing file tranfer operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -147,8 +163,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing device lock operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -167,8 +196,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing device unlock operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -187,8 +229,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while retrieving device location";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -207,8 +262,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing remove password operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -227,8 +295,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing control camera operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -248,6 +329,18 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
String errorMessage = "Issue in retrieving operation management service instance";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while retrieving device information";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -267,6 +360,18 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
String errorMessage = "Issue in retrieving operation management service instance";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while retrieving device logcat";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -285,8 +390,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing enterprice wipe device operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -305,8 +423,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing Android wipe-data device operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -325,8 +456,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing Android getApplicationList device operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -345,8 +489,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing Android ring device operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -365,8 +522,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing Android reboot device operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -385,8 +555,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing Android change LockTask mode operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -405,8 +588,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing mute device operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -426,8 +622,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing install application operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -446,8 +655,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing update application operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -467,8 +689,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing uninstall application operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -487,8 +722,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing blacklist application operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -507,8 +755,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing upgrade firmware operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -527,8 +788,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing configure vpn operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -547,8 +821,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing send notification operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -567,8 +854,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing configure wifi operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -587,8 +887,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing encrypt operation operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -607,8 +920,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing change lock code operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -627,8 +953,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing set password policy operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -647,8 +986,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing set webclip operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -669,8 +1021,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} 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());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while applying 'configure-global-proxy' operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@POST
|
|
|
|
@ -682,35 +1047,22 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
log.debug("Invoking 'send application configuration' operation");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (applicationRestrictionBeanWrapper == null || applicationRestrictionBeanWrapper.getOperation() == null) {
|
|
|
|
|
String errorMessage = "The payload of the application configuration operation is incorrect";
|
|
|
|
|
log.error(errorMessage);
|
|
|
|
|
throw new BadRequestException(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
|
|
|
|
}
|
|
|
|
|
ApplicationRestriction applicationRestriction = applicationRestrictionBeanWrapper.getOperation();
|
|
|
|
|
ProfileOperation operation = new ProfileOperation();
|
|
|
|
|
operation.setCode(AndroidConstants.OperationCodes.REMOTE_APP_CONFIG);
|
|
|
|
|
operation.setType(Operation.Type.PROFILE);
|
|
|
|
|
operation.setPayLoad(applicationRestriction.toJSON());
|
|
|
|
|
return (Response) AndroidAPIUtils.getOperationResponse(applicationRestrictionBeanWrapper.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";
|
|
|
|
|
try{
|
|
|
|
|
AndroidService androidService = AndroidAPIUtils.getAndroidService();
|
|
|
|
|
Response response = androidService.sendApplicationConfiguration(applicationRestrictionBeanWrapper);
|
|
|
|
|
return Response.status(Response.Status.CREATED).entity(response).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while sending app configuration";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
throw new UnexpectedServerErrorException(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -730,9 +1082,21 @@ public class DeviceManagementAdminAPIImpl implements DeviceManagementAdminAPI {
|
|
|
|
|
} catch (OperationManagementException e) {
|
|
|
|
|
String errorMessage = "Issue in retrieving operation management service instance";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
throw new UnexpectedServerErrorException(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().
|
|
|
|
|
setCode(HttpStatus.SC_INTERNAL_SERVER_ERROR).setMessage(errorMessage).build());
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
} catch (BadRequestExceptionDup e){
|
|
|
|
|
String msg = "Invalid request";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_BAD_REQUEST)
|
|
|
|
|
.setMessage(msg).build()).build();
|
|
|
|
|
} catch (AndroidDeviceMgtPluginException e) {
|
|
|
|
|
String errorMessage = "Error occured while executing configure-display-message operation";
|
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR)
|
|
|
|
|
.setMessage(errorMessage).build()).build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|