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(() -> {