use of org.apache.zeppelin.rest.exception.ParagraphNotFoundException in project zeppelin by apache.
the class NotebookService method removeParagraph.
public void removeParagraph(String noteId, String paragraphId, ServiceContext context, ServiceCallback<Paragraph> callback) throws IOException {
if (!checkPermission(noteId, Permission.WRITER, Message.OP.PARAGRAPH_REMOVE, context, callback)) {
return;
}
notebook.processNote(noteId, note -> {
if (note == null) {
throw new NoteNotFoundException(noteId);
}
if (note.getParagraph(paragraphId) == null) {
throw new ParagraphNotFoundException(paragraphId);
}
Paragraph p = note.removeParagraph(context.getAutheInfo().getUser(), paragraphId);
notebook.saveNote(note, context.getAutheInfo());
callback.onSuccess(p, context);
return null;
});
}
Aggregations