mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Removed url from application uninstall
(cherry picked from commit 45a582e)
This commit is contained in:
parent
07c7f2b6ff
commit
bfba008218
@ -43,9 +43,6 @@ public class ApplicationUninstallation extends AndroidOperation implements Seria
|
||||
@Pattern(regexp = "^[A-Za-z]*$")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(name = "url", value = "The URL of the application.", required = true)
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty(name = "name", value = "The name of the application.", required = true)
|
||||
@Size(min = 2, max = 45)
|
||||
private String name;
|
||||
@ -66,14 +63,6 @@ public class ApplicationUninstallation extends AndroidOperation implements Seria
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@ -558,22 +558,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
throw new BadRequestException(
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
||||
}
|
||||
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());
|
||||
}
|
||||
validateType(payload);
|
||||
} catch (MalformedURLException e) {
|
||||
String errorMessage = "Malformed application url.";
|
||||
log.error(errorMessage);
|
||||
@ -673,6 +658,9 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build());
|
||||
}
|
||||
ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation();
|
||||
JSONObject payload = new JSONObject(applicationUninstallation.toJSON());
|
||||
validateType(payload);
|
||||
|
||||
ProfileOperation operation = new ProfileOperation();
|
||||
operation.setCode(AndroidConstants.OperationCodes.UNINSTALL_APPLICATION);
|
||||
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
|
||||
@Path("/blacklist-applications")
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user