added validation for app name length when creating an app (Front end part)

pull/27/head
Ravindu Lakshan 2 years ago
parent 18f4a4c93c
commit 2f637cbc3f

@ -747,6 +747,9 @@ public interface ApplicationManagementPublisherAPI {
@ApiResponse(
code = 409,
message = "CONFLICT. \n Application exists"),
@ApiResponse(
code = 411,
message = "LENGTH_REQUIRED. \n Invalid application name length"),
@ApiResponse(
code = 400,
message = "Bad Request. \n Found invalid device type with the request."),

@ -373,11 +373,16 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).build();
}
if(appName.length()>20){
String msg = "Invalid app name, maximum length of the application name should be 20 characters.";
log.error(msg);
return Response.status(Response.Status.LENGTH_REQUIRED).build();
}
ApplicationManager applicationManager = APIUtil.getApplicationManager();
if (applicationManager.isExistingAppName(appName, deviceType)) {
return Response.status(Response.Status.CONFLICT).build();
}
return Response.status(Response.Status.OK).build();
return Response.status(Response.Status.OK).build();
} catch (BadRequestException e) {
log.error("Found invalid device type to check application existence.", e);
return Response.status(Response.Status.BAD_REQUEST).build();

Loading…
Cancel
Save