From ccfed654dfe5e2046a94cb47d844650784b9cd73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 25 Jan 2024 12:07:48 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AB=E3=83=80=E3=81=AE?= =?UTF-8?q?=E4=B8=80=E8=A6=A7=E3=82=92=E5=8F=96=E5=BE=97=E3=81=99=E3=82=8B?= =?UTF-8?q?=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 --- .../one/nem/lacerta/data/LacertaLibrary.java | 3 +++ .../lacerta/data/impl/LacertaLibraryImpl.java | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+) 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 c5957e8b..eb11e289 100644 --- a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java +++ b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java @@ -20,6 +20,9 @@ public interface LacertaLibrary { CompletableFuture getLibraryPage(String pageId, int limit); CompletableFuture getLibraryPage(String pageId, int limit, int offset); + // Get Folder List + CompletableFuture> getFolderList(String parentId); + // Create Folder CompletableFuture createFolder(String parentId, String name); 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 5067f701..139cf2bf 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 @@ -127,6 +127,31 @@ public class LacertaLibraryImpl implements LacertaLibrary { }); } + @Override + public CompletableFuture> getFolderList(String parentId) { + return CompletableFuture.supplyAsync(() -> { + List folderEntities; + if (parentId == null) { // When root folder + folderEntities = database.folderDao().findRootFolders(); + } else { + folderEntities = database.folderDao().findByParentId(parentId); + } + + ArrayList listItems = new ArrayList<>(); + for (FolderEntity childFolderEntity : folderEntities) { + logger.debug("LacertaLibraryImpl", "childFolderEntity.name: " + childFolderEntity.name); + ListItem listItem = new ListItem(); + listItem.setItemType(ListItemType.ITEM_TYPE_FOLDER); + listItem.setTitle(childFolderEntity.name); + listItem.setDescription("フォルダ"); // TODO-rca: ハードコーディングやめる + listItem.setItemId(childFolderEntity.id); + listItems.add(listItem); + } + + return listItems; + }); + } + @Override public CompletableFuture createFolder(String parentId, String name) { return CompletableFuture.supplyAsync(() -> {