Search in sources :

Example 1 with NoteNode

use of org.apache.zeppelin.notebook.NoteManager.NoteNode in project zeppelin by apache.

the class Notebook method restoreAll.

public void restoreAll(AuthenticationInfo subject) throws IOException {
    NoteManager.Folder trash = noteManager.getTrashFolder();
    // restore notes under trash folder
    // If the value changes in the loop, a concurrent modification exception is thrown.
    // Collector implementation of collect methods to maintain immutability.
    List<NoteNode> notes = trash.getNotes().values().stream().collect(Collectors.toList());
    for (NoteManager.NoteNode noteNode : notes) {
        moveNote(noteNode.getNoteId(), noteNode.getNotePath().replace("/~Trash", ""), subject);
    }
    // restore folders under trash folder
    List<Folder> folders = trash.getFolders().values().stream().collect(Collectors.toList());
    for (NoteManager.Folder folder : folders) {
        moveFolder(folder.getPath(), folder.getPath().replace("/~Trash", ""), subject);
    }
}
Also used : NoteNode(org.apache.zeppelin.notebook.NoteManager.NoteNode) NoteNode(org.apache.zeppelin.notebook.NoteManager.NoteNode) Folder(org.apache.zeppelin.notebook.NoteManager.Folder) Folder(org.apache.zeppelin.notebook.NoteManager.Folder)

Aggregations

Folder (org.apache.zeppelin.notebook.NoteManager.Folder)1 NoteNode (org.apache.zeppelin.notebook.NoteManager.NoteNode)1