예제 #1
0
  /**
   * Reload all notes from repository after clearing `notes` to reflect the changes of
   * added/deleted/modified notebooks on file system level.
   *
   * @throws IOException
   */
  public void reloadAllNotes(AuthenticationInfo subject) throws IOException {
    synchronized (notes) {
      notes.clear();
    }

    if (notebookRepo instanceof NotebookRepoSync) {
      NotebookRepoSync mainRepo = (NotebookRepoSync) notebookRepo;
      if (mainRepo.getRepoCount() > 1) {
        mainRepo.sync();
      }
    }

    List<NoteInfo> noteInfos = notebookRepo.list(subject);
    for (NoteInfo info : noteInfos) {
      loadNoteFromRepo(info.getId(), subject);
    }
  }