19 package org.turro.file.util;
21 import java.io.IOException;
22 import java.util.Collections;
23 import java.util.List;
25 import java.util.logging.Level;
26 import java.util.logging.Logger;
27 import java.util.stream.Collectors;
28 import org.turro.elephant.context.ElephantContext;
29 import org.turro.file.Document;
30 import org.turro.file.Folder;
43 public void remove() {
49 getPublishableFolder().remove();
53 getPrivateFolder().remove();
58 return getPublishableFolder().documents(1000);
59 }
catch (IOException ex) {
60 Logger.getLogger(
AttachFiles.class.getName()).log(Level.SEVERE,
null, ex);
62 return Collections.EMPTY_LIST;
67 return getPrivateFolder().documents(1000);
68 }
catch (IOException ex) {
69 Logger.getLogger(
AttachFiles.class.getName()).log(Level.SEVERE,
null, ex);
71 return Collections.EMPTY_LIST;
76 private Folder getPublishableFolder() {
80 private Folder getPrivateFolder() {
90 return folder.folders().stream()
91 .map(f ->
"/" + root +
"/" + f.name()).collect(Collectors.toSet());
93 }
catch (IOException ex) {
94 Logger.getLogger(
AttachFiles.class.getName()).log(Level.SEVERE,
null, ex);
96 return Collections.EMPTY_SET;
102 if(folder.exists()) {
103 return folder.folders().stream()
104 .map(f ->
"/" + root +
"/" + f.name()).collect(Collectors.toSet());
106 }
catch (IOException ex) {
107 Logger.getLogger(
AttachFiles.class.getName()).log(Level.SEVERE,
null, ex);
109 return Collections.EMPTY_SET;
118 private final String path;
static String getRealPath(String path)
static Set< String > getAllPublishablePaths(String root)
static AttachFiles from(String path)
List< Document > privateDocs()
void toFolder(Folder folder)
static Set< String > getAllPrivatePaths(String root)
List< Document > publishableDocs()