Basic implementation for notes app
This commit is contained in:
@@ -4,6 +4,7 @@ import de.nbscloud.webcontainer.registry.App;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -12,22 +13,80 @@ public interface FilesService {
|
||||
LocalDateTime lastModified) {
|
||||
}
|
||||
|
||||
public void createAppDirectory(App app);
|
||||
class ContentTree {
|
||||
private String name;
|
||||
private boolean directory;
|
||||
private String path;
|
||||
private List<ContentTree> subTree = new ArrayList<>();
|
||||
private ContentTree parent;
|
||||
|
||||
public void createDirectory(App app, Path path);
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void createFile(App app, Path path, byte[] content);
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void delete(App app, Path path);
|
||||
public boolean isDirectory() {
|
||||
return directory;
|
||||
}
|
||||
|
||||
public void get(App app, Path path);
|
||||
public void setDirectory(boolean directory) {
|
||||
this.directory = directory;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public List<ContentTree> getSubTree() {
|
||||
return subTree;
|
||||
}
|
||||
|
||||
public void setSubTree(List<ContentTree> subTree) {
|
||||
this.subTree = subTree;
|
||||
}
|
||||
|
||||
public boolean getHasSubTree() {
|
||||
return !this.subTree.isEmpty();
|
||||
}
|
||||
|
||||
public ContentTree getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(ContentTree parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
}
|
||||
|
||||
void createAppDirectory(App app);
|
||||
|
||||
void createDirectory(App app, Path path);
|
||||
|
||||
void createFile(App app, Path path, byte[] content);
|
||||
|
||||
void overwriteFile(App app, Path path, byte[] content);
|
||||
|
||||
void delete(App app, Path path);
|
||||
|
||||
byte[] get(App app, Path path);
|
||||
|
||||
/**
|
||||
* Paths in return list are always relative to the appDir.
|
||||
* Paths in return list are always relative to the appDir. Non-recursive list.
|
||||
*
|
||||
* @param app to list the files for
|
||||
* @param path in case of {@link Optional#EMPTY} the appDir is used as start dir. If not empty, path has to be relative
|
||||
* to the appDir
|
||||
*/
|
||||
public List<ContentContainer> list(App app, Optional<Path> path);
|
||||
List<ContentContainer> list(App app, Optional<Path> path);
|
||||
|
||||
ContentTree getTree(App app, Optional<Path> path);
|
||||
|
||||
List<String> collectDirs(App app, Optional<Path> path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user