@Test public void testGetNote() throws IOException { Note notebook = repo.get("AAAAA", auth); assertThat(notebook).isNotNull(); assertThat(notebook.getId()).isEqualTo("2A94M5J1Z"); }
@Override public Note get(String noteId, AuthenticationInfo subject) throws IOException { if (StringUtils.isBlank(noteId) || !isSubjectValid(subject)) { return EMPTY_NOTE; } String token = getUserToken(subject.getUser()); String response = restApiClient.get(token, noteId); Note note = GSON.fromJson(response, Note.class); if (note == null) { return EMPTY_NOTE; } LOG.info("ZeppelinHub REST API get note {} ", noteId); return note; }
ZeppelinHubRepo implements NotebookRepo { @Override public Note get(String noteId, AuthenticationInfo subject) throws IOException { if (StringUtils.isBlank(noteId) || !isSubjectValid(subject)) { return EMPTY_NOTE; } String token = getUserToken(subject.getUser()); String response = restApiClient.get(token, noteId); Note note = GSON.fromJson(response, Note.class); if (note == null) { return EMPTY_NOTE; } LOG.info("ZeppelinHub REST API get note {} ", noteId); return note; } }
ZeppelinHubRepo implements NotebookRepo { @Override public Note get(String noteId, AuthenticationInfo subject) throws IOException { if (StringUtils.isBlank(noteId) || !isSubjectValid(subject)) { return EMPTY_NOTE; } String token = getUserToken(subject.getUser()); String response = restApiClient.get(token, noteId); Note note = GSON.fromJson(response, Note.class); if (note == null) { return EMPTY_NOTE; } LOG.info("ZeppelinHub REST API get note {} ", noteId); return note; } ZeppelinHubRepo(ZeppelinConfiguration conf); }
ZeppelinHubRepo implements NotebookRepo { @Override public Note get(String noteId, AuthenticationInfo subject) throws IOException { if (StringUtils.isBlank(noteId) || !isSubjectValid(subject)) { return EMPTY_NOTE; } String token = getUserToken(subject.getUser()); String response = restApiClient.get(token, noteId); Note note = GSON.fromJson(response, Note.class); if (note == null) { return EMPTY_NOTE; } LOG.info("ZeppelinHub REST API get note {} ", noteId); return note; } ZeppelinHubRepo(ZeppelinConfiguration conf); @Override List<NoteInfo> list(AuthenticationInfo subject); @Override Note get(String noteId, AuthenticationInfo subject); @Override void save(Note note, AuthenticationInfo subject); @Override void remove(String noteId, AuthenticationInfo subject); @Override void close(); @Override Revision checkpoint(String noteId, String checkpointMsg, AuthenticationInfo subject); @Override Note get(String noteId, String revId, AuthenticationInfo subject); @Override List<Revision> revisionHistory(String noteId, AuthenticationInfo subject); @Override List<NotebookRepoSettingsInfo> getSettings(AuthenticationInfo subject); @Override void updateSettings(Map<String, String> settings, AuthenticationInfo subject); @Override Note setNoteRevision(String noteId, String revId, AuthenticationInfo subject); }
ZeppelinHubRepo implements NotebookRepo { @Override public Note get(String noteId, AuthenticationInfo subject) throws IOException { if (StringUtils.isBlank(noteId) || !isSubjectValid(subject)) { return EMPTY_NOTE; } String token = getUserToken(subject.getUser()); String response = restApiClient.get(token, noteId); Note note = GSON.fromJson(response, Note.class); if (note == null) { return EMPTY_NOTE; } LOG.info("ZeppelinHub REST API get note {} ", noteId); return note; } ZeppelinHubRepo(ZeppelinConfiguration conf); @Override List<NoteInfo> list(AuthenticationInfo subject); @Override Note get(String noteId, AuthenticationInfo subject); @Override void save(Note note, AuthenticationInfo subject); @Override void remove(String noteId, AuthenticationInfo subject); @Override void close(); @Override Revision checkpoint(String noteId, String checkpointMsg, AuthenticationInfo subject); @Override Note get(String noteId, String revId, AuthenticationInfo subject); @Override List<Revision> revisionHistory(String noteId, AuthenticationInfo subject); @Override List<NotebookRepoSettingsInfo> getSettings(AuthenticationInfo subject); @Override void updateSettings(Map<String, String> settings, AuthenticationInfo subject); @Override Note setNoteRevision(String noteId, String revId, AuthenticationInfo subject); static final String TOKEN_HEADER; }