@Test public void getFolderIdTest() { Note note = new Note(repo, interpreterFactory, interpreterSettingManager, jobListenerFactory, index, credentials, noteEventListener); note.setName("this/is/a/folder/noteName"); assertEquals("this/is/a/folder", note.getFolderId()); note.setName("/this/is/a/folder/noteName"); assertEquals("this/is/a/folder", note.getFolderId()); note.setName("noteOnRootFolder"); assertEquals(Folder.ROOT_FOLDER_ID, note.getFolderId()); note.setName("/noteOnRootFolderStartsWithSlash"); assertEquals(Folder.ROOT_FOLDER_ID, note.getFolderId()); }
public String getFolderId() { String notePath = getName(); if (notePath.charAt(0) == '/') notePath = notePath.substring(1); int lastSlashIndex = notePath.lastIndexOf("/"); if (lastSlashIndex < 0) { return Folder.ROOT_FOLDER_ID; } String folderId = notePath.substring(0, lastSlashIndex); return folderId; }
Note implements Serializable, ParagraphJobListener { public String getFolderId() { String notePath = getName(); if (notePath.charAt(0) == '/') notePath = notePath.substring(1); int lastSlashIndex = notePath.lastIndexOf("/"); if (lastSlashIndex < 0) { return Folder.ROOT_FOLDER_ID; } String folderId = notePath.substring(0, lastSlashIndex); return folderId; } }
Note implements Serializable, ParagraphJobListener { public String getFolderId() { String notePath = getName(); if (notePath.charAt(0) == '/') notePath = notePath.substring(1); int lastSlashIndex = notePath.lastIndexOf("/"); if (lastSlashIndex < 0) { return Folder.ROOT_FOLDER_ID; } String folderId = notePath.substring(0, lastSlashIndex); return folderId; } Note();  Note(NotebookRepo repo, InterpreterFactory factory,
      InterpreterSettingManager interpreterSettingManager, JobListenerFactory jlFactory,
      SearchService noteIndex, Credentials credentials, NoteEventListener noteEventListener); }
Note implements Serializable, ParagraphJobListener { public String getFolderId() { String notePath = getName(); if (notePath.charAt(0) == '/') notePath = notePath.substring(1); int lastSlashIndex = notePath.lastIndexOf("/"); if (lastSlashIndex < 0) { return Folder.ROOT_FOLDER_ID; } String folderId = notePath.substring(0, lastSlashIndex); return folderId; } Note();  Note(NotebookRepo repo, InterpreterFactory factory,
      InterpreterSettingManager interpreterSettingManager, JobListenerFactory jlFactory,
      SearchService noteIndex, Credentials credentials, NoteEventListener noteEventListener); boolean isPersonalizedMode(); void setPersonalizedMode(Boolean value); String getId(); String getName(); String getNameWithoutPath(); String getFolderId(); boolean isNameEmpty(); void setName(String name); void setNoteNameListener(NoteNameListener listener); void initializeJobListenerForParagraph(Paragraph paragraph); void setIndex(SearchService index); Credentials getCredentials(); void setCredentials(Credentials credentials); Paragraph addParagraph(AuthenticationInfo authenticationInfo); Paragraph insertParagraph(int index, AuthenticationInfo authenticationInfo); Paragraph removeParagraph(String user, String paragraphId); Paragraph clearParagraphOutput(String paragraphId, String user); void clearAllParagraphOutput(); void moveParagraph(String paragraphId, int index); void moveParagraph(String paragraphId, int index, boolean throwWhenIndexIsOutOfBound); boolean isLastParagraph(String paragraphId); Paragraph getParagraph(String paragraphId); Paragraph getLastParagraph(); List<Map<String, String>> generateParagraphsInfo(); Map<String, String> generateSingleParagraphInfo(String paragraphId); synchronized void runAll(); void runAll(AuthenticationInfo authenticationInfo); void run(String paragraphId); boolean isTrash(); List<InterpreterCompletion> completion(String paragraphId, String buffer, int cursor); List<Paragraph> getParagraphs(); void persist(AuthenticationInfo subject); void persist(int maxDelaySec, AuthenticationInfo subject); Note getUserNote(String user); Map<String, Object> getConfig(); void setConfig(Map<String, Object> config); Map<String, Object> getInfo(); void setInfo(Map<String, Object> info); @Override void beforeStatusChange(Job job, Status before, Status after); @Override void afterStatusChange(Job job, Status before, Status after); @Override void onProgressUpdate(Job job, int progress); @Override void onOutputAppend(Paragraph paragraph, int idx, String output); @Override void onOutputUpdate(Paragraph paragraph, int idx, InterpreterResultMessage msg); @Override void onOutputUpdateAll(Paragraph paragraph, List<InterpreterResultMessage> msgs); }
Note implements Serializable, ParagraphJobListener { public String getFolderId() { String notePath = getName(); if (notePath.charAt(0) == '/') notePath = notePath.substring(1); int lastSlashIndex = notePath.lastIndexOf("/"); if (lastSlashIndex < 0) { return Folder.ROOT_FOLDER_ID; } String folderId = notePath.substring(0, lastSlashIndex); return folderId; } Note();  Note(NotebookRepo repo, InterpreterFactory factory,
      InterpreterSettingManager interpreterSettingManager, JobListenerFactory jlFactory,
      SearchService noteIndex, Credentials credentials, NoteEventListener noteEventListener); boolean isPersonalizedMode(); void setPersonalizedMode(Boolean value); String getId(); String getName(); String getNameWithoutPath(); String getFolderId(); boolean isNameEmpty(); void setName(String name); void setNoteNameListener(NoteNameListener listener); void initializeJobListenerForParagraph(Paragraph paragraph); void setIndex(SearchService index); Credentials getCredentials(); void setCredentials(Credentials credentials); Paragraph addParagraph(AuthenticationInfo authenticationInfo); Paragraph insertParagraph(int index, AuthenticationInfo authenticationInfo); Paragraph removeParagraph(String user, String paragraphId); Paragraph clearParagraphOutput(String paragraphId, String user); void clearAllParagraphOutput(); void moveParagraph(String paragraphId, int index); void moveParagraph(String paragraphId, int index, boolean throwWhenIndexIsOutOfBound); boolean isLastParagraph(String paragraphId); Paragraph getParagraph(String paragraphId); Paragraph getLastParagraph(); List<Map<String, String>> generateParagraphsInfo(); Map<String, String> generateSingleParagraphInfo(String paragraphId); synchronized void runAll(); void runAll(AuthenticationInfo authenticationInfo); void run(String paragraphId); boolean isTrash(); List<InterpreterCompletion> completion(String paragraphId, String buffer, int cursor); List<Paragraph> getParagraphs(); void persist(AuthenticationInfo subject); void persist(int maxDelaySec, AuthenticationInfo subject); Note getUserNote(String user); Map<String, Object> getConfig(); void setConfig(Map<String, Object> config); Map<String, Object> getInfo(); void setInfo(Map<String, Object> info); @Override void beforeStatusChange(Job job, Status before, Status after); @Override void afterStatusChange(Job job, Status before, Status after); @Override void onProgressUpdate(Job job, int progress); @Override void onOutputAppend(Paragraph paragraph, int idx, String output); @Override void onOutputUpdate(Paragraph paragraph, int idx, InterpreterResultMessage msg); @Override void onOutputUpdateAll(Paragraph paragraph, List<InterpreterResultMessage> msgs);  }