@DELETE
@Path("/{id}/project/{path:.*}")
@ApiOperation(
value = "Remove the project from the workspace",
notes = "This operation can be performed only by the workspace owner")
@ApiResponses({
@ApiResponse(code = 204, message = "The project successfully removed"),
@ApiResponse(code = 403, message = "The user does not have access remove the project"),
@ApiResponse(code = 404, message = "The workspace not found"),
@ApiResponse(code = 500, message = "Internal server error occurred")
})
public void deleteProject(
@ApiParam("The workspace id") @PathParam("id") String id,
@ApiParam("The name of the project to remove") @PathParam("path") String path)
throws ServerException, BadRequestException, NotFoundException, ConflictException,
ForbiddenException {
final WorkspaceImpl workspace = workspaceManager.getWorkspace(id);
final String normalizedPath = path.startsWith("/") ? path : '/' + path;
if (workspace
.getConfig()
.getProjects()
.removeIf(project -> project.getPath().equals(normalizedPath))) {
doUpdate(id, workspace);
}
}