|
|
@ -558,22 +558,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
|
|
|
throw new BadRequestException(
|
|
|
|
throw new BadRequestException(
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (payload.has("type")) {
|
|
|
|
validateType(payload);
|
|
|
|
String type = payload.getString("type");
|
|
|
|
|
|
|
|
if (!"enterprise".equalsIgnoreCase(type)
|
|
|
|
|
|
|
|
&& !"public".equalsIgnoreCase(type)
|
|
|
|
|
|
|
|
&& !"webapp".equalsIgnoreCase(type)) {
|
|
|
|
|
|
|
|
String errorMessage = "Invalid application type.";
|
|
|
|
|
|
|
|
log.error(errorMessage);
|
|
|
|
|
|
|
|
throw new BadRequestException(
|
|
|
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
String errorMessage = "Application type is missing.";
|
|
|
|
|
|
|
|
log.error(errorMessage);
|
|
|
|
|
|
|
|
throw new BadRequestException(
|
|
|
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (MalformedURLException e) {
|
|
|
|
} catch (MalformedURLException e) {
|
|
|
|
String errorMessage = "Malformed application url.";
|
|
|
|
String errorMessage = "Malformed application url.";
|
|
|
|
log.error(errorMessage);
|
|
|
|
log.error(errorMessage);
|
|
|
@ -673,6 +658,9 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation();
|
|
|
|
ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation();
|
|
|
|
|
|
|
|
JSONObject payload = new JSONObject(applicationUninstallation.toJSON());
|
|
|
|
|
|
|
|
validateType(payload);
|
|
|
|
|
|
|
|
|
|
|
|
ProfileOperation operation = new ProfileOperation();
|
|
|
|
ProfileOperation operation = new ProfileOperation();
|
|
|
|
operation.setCode(AndroidConstants.OperationCodes.UNINSTALL_APPLICATION);
|
|
|
|
operation.setCode(AndroidConstants.OperationCodes.UNINSTALL_APPLICATION);
|
|
|
|
operation.setType(Operation.Type.PROFILE);
|
|
|
|
operation.setType(Operation.Type.PROFILE);
|
|
|
@ -698,6 +686,25 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void validateType(JSONObject payload) {
|
|
|
|
|
|
|
|
if (payload.has("type")) {
|
|
|
|
|
|
|
|
String type = payload.getString("type");
|
|
|
|
|
|
|
|
if (!"enterprise".equalsIgnoreCase(type)
|
|
|
|
|
|
|
|
&& !"public".equalsIgnoreCase(type)
|
|
|
|
|
|
|
|
&& !"webapp".equalsIgnoreCase(type)) {
|
|
|
|
|
|
|
|
String errorMessage = "Invalid application type.";
|
|
|
|
|
|
|
|
log.error(errorMessage);
|
|
|
|
|
|
|
|
throw new BadRequestException(
|
|
|
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
String errorMessage = "Application type is missing.";
|
|
|
|
|
|
|
|
log.error(errorMessage);
|
|
|
|
|
|
|
|
throw new BadRequestException(
|
|
|
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@POST
|
|
|
|
@POST
|
|
|
|
@Path("/blacklist-applications")
|
|
|
|
@Path("/blacklist-applications")
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|