mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 07:53:15 +00:00
フォルダの一覧を取得するメソッド作成
This commit is contained in:
parent
03d78b1200
commit
ccfed654df
|
@ -20,6 +20,9 @@ public interface LacertaLibrary {
|
|||
CompletableFuture<LibraryItemPage> getLibraryPage(String pageId, int limit);
|
||||
CompletableFuture<LibraryItemPage> getLibraryPage(String pageId, int limit, int offset);
|
||||
|
||||
// Get Folder List
|
||||
CompletableFuture<ArrayList<ListItem>> getFolderList(String parentId);
|
||||
|
||||
// Create Folder
|
||||
CompletableFuture<String> createFolder(String parentId, String name);
|
||||
|
||||
|
|
|
@ -127,6 +127,31 @@ public class LacertaLibraryImpl implements LacertaLibrary {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<ArrayList<ListItem>> getFolderList(String parentId) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
List<FolderEntity> folderEntities;
|
||||
if (parentId == null) { // When root folder
|
||||
folderEntities = database.folderDao().findRootFolders();
|
||||
} else {
|
||||
folderEntities = database.folderDao().findByParentId(parentId);
|
||||
}
|
||||
|
||||
ArrayList<ListItem> 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<String> createFolder(String parentId, String name) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
|
|
Loading…
Reference in New Issue
Block a user