public List<Note> getAllNotes() { if (conf.getBoolean(ConfVars.ZEPPELIN_NOTEBOOK_RELOAD_FROM_STORAGE)) { try { reloadAllNotes(); } catch (IOException e) { logger.error("Cannot reload notes from storage", e); } } synchronized (notes) { List<Note> noteList = new ArrayList<Note>(notes.values()); Collections.sort( noteList, new Comparator() { @Override public int compare(Object one, Object two) { Note note1 = (Note) one; Note note2 = (Note) two; String name1 = note1.id(); if (note1.getName() != null) { name1 = note1.getName(); } String name2 = note2.id(); if (note2.getName() != null) { name2 = note2.getName(); } ((Note) one).getName(); return name1.compareTo(name2); } }); return noteList; } }
/** * Create new note. * * @return * @throws IOException */ public Note createNote() throws IOException { if (conf.getBoolean(ConfVars.ZEPPELIN_NOTEBOOK_AUTO_INTERPRETER_BINDING)) { return createNote(replFactory.getDefaultInterpreterSettingList()); } else { return createNote(null); } }
/** * Create new note. * * @throws IOException */ public Note createNote(AuthenticationInfo subject) throws IOException { Note note; if (conf.getBoolean(ConfVars.ZEPPELIN_NOTEBOOK_AUTO_INTERPRETER_BINDING)) { note = createNote(replFactory.getDefaultInterpreterSettingList(), subject); } else { note = createNote(null, subject); } notebookIndex.addIndexDoc(note); return note; }