mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
ドキュメントを正常に取得できるようになった
This commit is contained in:
parent
c7f2a3eebe
commit
de30eb241c
|
@ -71,16 +71,29 @@ public class LacertaLibraryImpl implements LacertaLibrary {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
LibraryItemPage libraryItemPage = new LibraryItemPage();
|
LibraryItemPage libraryItemPage = new LibraryItemPage();
|
||||||
|
|
||||||
FolderEntity folderEntity = database.folderDao().findById(pageId);
|
List<FolderEntity> folderEntities;
|
||||||
if (folderEntity == null) {
|
List<DocumentEntity> documentEntities;
|
||||||
logger.warn("LacertaLibraryImpl", pageId + " is not found.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<FolderEntity> folderEntities = database.folderDao().findByParentId(pageId);
|
if (pageId == null) { // When root folder
|
||||||
logger.debug("LacertaLibraryImpl", "folderEntities.size(): " + folderEntities.size());
|
libraryItemPage.setPageTitle("ライブラリ");
|
||||||
List<DocumentEntity> documentEntities = database.documentDao().findByParentId(pageId);
|
libraryItemPage.setPageId(null);
|
||||||
logger.debug("LacertaLibraryImpl", "documentEntities.size(): " + documentEntities.size());
|
libraryItemPage.setParentId(null);
|
||||||
|
|
||||||
|
folderEntities = database.folderDao().findRootFolders();
|
||||||
|
documentEntities = database.documentDao().findRootDocuments();
|
||||||
|
} else {
|
||||||
|
FolderEntity folderEntity = database.folderDao().findById(pageId);
|
||||||
|
if (folderEntity == null) {
|
||||||
|
logger.warn("LacertaLibraryImpl", pageId + " is not found.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
libraryItemPage.setPageTitle(folderEntity.name);
|
||||||
|
libraryItemPage.setPageId(folderEntity.id);
|
||||||
|
libraryItemPage.setParentId(folderEntity.parentId);
|
||||||
|
|
||||||
|
folderEntities = database.folderDao().findByParentId(pageId);
|
||||||
|
documentEntities = database.documentDao().findByParentId(pageId);
|
||||||
|
}
|
||||||
|
|
||||||
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());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user