From da8d4fb4fcb1ca6c6405bee8a59191528e4c7c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Mon, 22 Jan 2024 20:22:51 +0900 Subject: [PATCH] =?UTF-8?q?PublicPath=E3=82=92=E7=94=9F=E6=88=90=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/one/nem/lacerta/data/LacertaLibrary.java | 4 ++++ .../one/nem/lacerta/data/impl/LacertaLibraryImpl.java | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java index eda15fce..1269d255 100644 --- a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java +++ b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java @@ -7,6 +7,7 @@ import one.nem.lacerta.model.ListItem; import one.nem.lacerta.model.ListItemType; import one.nem.lacerta.model.LibraryItemPage; +import one.nem.lacerta.model.PublicPath; import one.nem.lacerta.model.document.DocumentDetail; public interface LacertaLibrary { @@ -22,4 +23,7 @@ public interface LacertaLibrary { // Create Folder CompletableFuture createFolder(String path, String name); + // Get Public Path + CompletableFuture getPublicPath(String itemId, ListItemType itemType); + } diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java index 46b8dc23..16a9235c 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java @@ -148,16 +148,20 @@ public class LacertaLibraryImpl implements LacertaLibrary { if (itemType == ListItemType.ITEM_TYPE_DOCUMENT) { DocumentEntity documentEntity = database.documentDao().findById(itemId); if (documentEntity == null) { + logger.warn("LacertaLibraryImpl", itemId + " is not found."); return null; } - return new PublicPath().resolve(documentEntity.publicPath); + PublicPath publicPath = recursiveResolve(documentEntity.parentId); + publicPath.resolve(documentEntity.title); + return publicPath; } else if (itemType == ListItemType.ITEM_TYPE_FOLDER) { FolderEntity folderEntity = database.folderDao().findById(itemId); if (folderEntity == null) { return null; } - return new PublicPath().resolve(folderEntity.publicPath); + return recursiveResolve(folderEntity.id); } else { + logger.warn("LacertaLibraryImpl", "Unknown ListItemType: " + itemType); return null; } });