ドキュメントを正常に取得できるようになった

This commit is contained in:
r-ca 2024-01-22 23:29:49 +09:00
parent c7f2a3eebe
commit de30eb241c
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -71,16 +71,29 @@ public class LacertaLibraryImpl implements LacertaLibrary {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
LibraryItemPage libraryItemPage = new LibraryItemPage(); LibraryItemPage libraryItemPage = new LibraryItemPage();
List<FolderEntity> folderEntities;
List<DocumentEntity> documentEntities;
if (pageId == null) { // When root folder
libraryItemPage.setPageTitle("ライブラリ");
libraryItemPage.setPageId(null);
libraryItemPage.setParentId(null);
folderEntities = database.folderDao().findRootFolders();
documentEntities = database.documentDao().findRootDocuments();
} else {
FolderEntity folderEntity = database.folderDao().findById(pageId); FolderEntity folderEntity = database.folderDao().findById(pageId);
if (folderEntity == null) { if (folderEntity == null) {
logger.warn("LacertaLibraryImpl", pageId + " is not found."); logger.warn("LacertaLibraryImpl", pageId + " is not found.");
return null; return null;
} }
libraryItemPage.setPageTitle(folderEntity.name);
libraryItemPage.setPageId(folderEntity.id);
libraryItemPage.setParentId(folderEntity.parentId);
List<FolderEntity> folderEntities = database.folderDao().findByParentId(pageId); folderEntities = database.folderDao().findByParentId(pageId);
logger.debug("LacertaLibraryImpl", "folderEntities.size(): " + folderEntities.size()); documentEntities = database.documentDao().findByParentId(pageId);
List<DocumentEntity> documentEntities = database.documentDao().findByParentId(pageId); }
logger.debug("LacertaLibraryImpl", "documentEntities.size(): " + documentEntities.size());
ArrayList<ListItem> listItems = new ArrayList<>(); ArrayList<ListItem> listItems = new ArrayList<>();
for (FolderEntity childFolderEntity : folderEntities) { for (FolderEntity childFolderEntity : folderEntities) {
@ -103,9 +116,6 @@ public class LacertaLibraryImpl implements LacertaLibrary {
listItems.add(listItem); listItems.add(listItem);
} }
libraryItemPage.setPageTitle(folderEntity.name);
libraryItemPage.setPageId(folderEntity.id);
libraryItemPage.setParentId(folderEntity.parentId);
libraryItemPage.setListItems(listItems); libraryItemPage.setListItems(listItems);
logger.debug("LacertaLibraryImpl", "libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size()); logger.debug("LacertaLibraryImpl", "libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size());