From fc6cbb9d376cbd34c35a330f72f1e4128bf1d639 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:06:19 +0900 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E9=83=A8=E5=BB=83=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/data/LacertaLibrary.java | 4 +- .../lacerta/data/impl/LacertaLibraryImpl.java | 68 ------------------- 2 files changed, 1 insertion(+), 71 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 6d424179..eda15fce 100644 --- a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java +++ b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java @@ -15,9 +15,7 @@ public interface LacertaLibrary { CompletableFuture> getRecentDocument(int limit); CompletableFuture> getRecentDocument(int limit, int offset); - // Get Library page - CompletableFuture getLibraryPage(int limit); - CompletableFuture getLibraryPage(int limit, int offset); + // Get Library Page CompletableFuture getLibraryPage(String pageId, int limit); CompletableFuture getLibraryPage(String pageId, int limit, int offset); 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 f1897557..6b2e981b 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 @@ -64,74 +64,6 @@ public class LacertaLibraryImpl implements LacertaLibrary { return null; // TODO-rca: Implement } - // Internal - private CompletableFuture> getFolderEntitiesByPublicPath(String publicPath) { - return CompletableFuture.supplyAsync(() -> { - return database.folderDao().findByPublicPathWithLimit(publicPath, 10); // TODO-rca: ハードコーディングやめる - }); - } - - private CompletableFuture> getDocumentEntitiesByPublicPath(String publicPath) { - return CompletableFuture.supplyAsync(() -> { - return database.documentDao().findByPublicPathWithLimit(publicPath, 10); // TODO-rca: ハードコーディングやめる - }); - } - - @Override - public CompletableFuture getLibraryPage(int limit) { - return CompletableFuture.supplyAsync(() -> { - - // 5秒フリーズさせる - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - LibraryItemPage libraryItemPage = new LibraryItemPage(); - - List folderEntities = getFolderEntitiesByPublicPath("/").join(); - logger.debug("LacertaLibraryImpl", "folderEntities.size(): " + folderEntities.size()); - List documentEntities = getDocumentEntitiesByPublicPath("/").join(); - logger.debug("LacertaLibraryImpl", "documentEntities.size(): " + documentEntities.size()); - - ArrayList listItems = new ArrayList<>(); - for (FolderEntity folderEntity : folderEntities) { - logger.debug("LacertaLibraryImpl", "folderEntity.name: " + folderEntity.name); - ListItem listItem = new ListItem(); - listItem.setItemType(ListItemType.ITEM_TYPE_FOLDER); - listItem.setTitle(folderEntity.name); - listItem.setDescription("フォルダ"); // TODO-rca: ハードコーディングやめる - listItem.setItemId(folderEntity.id); - listItems.add(listItem); - } - for (DocumentEntity documentEntity : documentEntities) { - logger.debug("LacertaLibraryImpl", "documentEntity.title: " + documentEntity.title); - ListItem listItem = new ListItem(); - listItem.setItemType(ListItemType.ITEM_TYPE_DOCUMENT); - listItem.setTitle(documentEntity.title); -// listItem.setDescription(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm").format(documentEntity.updatedAt.toInstant())); - listItem.setItemId(documentEntity.id); - listItems.add(listItem); - } - - libraryItemPage.setPageTitle("/"); - libraryItemPage.setPageId("root"); - libraryItemPage.setListItems(listItems); - - logger.debug("LacertaLibraryImpl", "libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size()); - - return libraryItemPage; - }); - } - - @Override - public CompletableFuture getLibraryPage(int limit, int offset) { - return CompletableFuture.supplyAsync(() -> { - return null; - }); - } - @Override public CompletableFuture getLibraryPage(String pageId, int limit) { return CompletableFuture.supplyAsync(() -> {