From 5d866d8513239f2c6c07f225d784db281177695a Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 17 Dec 2023 23:27:39 +0900 Subject: [PATCH] =?UTF-8?q?WIP=20=E3=83=AA=E3=83=9F=E3=83=83=E3=83=88?= =?UTF-8?q?=E3=81=82=E3=82=8A=E3=81=AE=E5=85=A8=E4=BB=B6=E5=8F=96=E5=BE=97?= =?UTF-8?q?=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/data/impl/DocumentImpl.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java index d6aacc4b..0be30724 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java @@ -37,6 +37,40 @@ public class DocumentImpl implements Document{ @Inject DeviceInfoUtils deviceInfoUtils; + @Override + public ArrayList getAllDocumentMetas(int limit) { + ArrayList documentMetas = new ArrayList<>(); + List documentEntities = database.documentDao().getAllWithLimit(limit); + + for (DocumentEntity documentEntity : documentEntities) { + // タグ取得 + // TODO-rca: 切り出すべきかも? + List tagEntities = database.tagDao().findByIds(documentEntity.tagIds); + ArrayList documentTags = new ArrayList<>(); + for (TagEntity tagEntity : tagEntities) { + documentTags.add(new DocumentTag(tagEntity.id, tagEntity.tagName, tagEntity.color)); + } + + // 組み立て処理 + // 可読性が終わるのでコンストラクタはつかわないほうがいいかも? + DocumentMeta documentMeta = new DocumentMeta(); + documentMeta.setId(documentEntity.id); + documentMeta.setTitle(documentEntity.title); + documentMeta.setCreatedAt(documentEntity.createdAt); + documentMeta.setUpdatedAt(documentEntity.updatedAt); + documentMeta.setTags(documentTags); + + documentMetas.add(documentMeta); + } + + return documentMetas; + } + + @Override + public ArrayList getAllDocumentMetas(int limit, int offset) { + return null; // TODO-rca: 実装する + } + @Override public ArrayList getRecentDocumentMetas(int limit) { // ArrayList documentMetas = new ArrayList<>();