getRecentDocument実装

This commit is contained in:
ろむねこ 2024-01-17 12:52:13 +09:00
parent 1c3fdf921d
commit e0d63122bd
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -1,14 +1,19 @@
package one.nem.lacerta.data.impl; package one.nem.lacerta.data.impl;
import java.text.DateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.data.LacertaLibrary;
import one.nem.lacerta.model.LibraryItemPage; import one.nem.lacerta.model.LibraryItemPage;
import one.nem.lacerta.model.ListItem; import one.nem.lacerta.model.ListItem;
import one.nem.lacerta.model.ListItemType;
import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.source.database.LacertaDatabase; import one.nem.lacerta.source.database.LacertaDatabase;
import one.nem.lacerta.source.database.common.DateTypeConverter;
import one.nem.lacerta.source.database.entity.DocumentEntity;
import one.nem.lacerta.utils.LacertaLogger; import one.nem.lacerta.utils.LacertaLogger;
public class LacertaLibraryImpl implements LacertaLibrary { public class LacertaLibraryImpl implements LacertaLibrary {
@ -21,12 +26,23 @@ public class LacertaLibraryImpl implements LacertaLibrary {
@Override @Override
public ArrayList<ListItem> getRecentDocument(int limit) { public ArrayList<ListItem> getRecentDocument(int limit) {
return null; List<DocumentEntity> documentEntities = database.documentDao().getRecentDocument(limit);
ArrayList<ListItem> listItems = new ArrayList<>();
for (DocumentEntity documentEntity : documentEntities) {
ListItem listItem = new ListItem();
listItem.setItemType(ListItemType.ITEM_TYPE_DOCUMENT);
listItem.setTitle(documentEntity.title);
listItem.setDescription(DateFormat.getDateInstance().format(documentEntity.updatedAt));
listItem.setItemId(documentEntity.id);
listItems.add(listItem);
}
return listItems;
} }
@Override @Override
public ArrayList<ListItem> getRecentDocument(int limit, int offset) { public ArrayList<ListItem> getRecentDocument(int limit, int offset) {
return null; return null; // TODO-rca: Implement
} }
@Override @Override