From e033eb754d35bf4078e74d24dca36699e7def2bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 14 Dec 2023 11:09:11 +0900 Subject: [PATCH] WIP --- .../nem/lacerta/data/impl/DocumentImpl.java | 20 +++++++++++++++++++ 1 file changed, 20 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 406c83a6..51c0d42e 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 @@ -9,10 +9,12 @@ import one.nem.lacerta.data.Document; import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.model.document.DocumentDetail; +import one.nem.lacerta.model.document.path.DocumentPath; import one.nem.lacerta.model.document.tag.DocumentTag; import one.nem.lacerta.source.database.LacertaDatabase; import one.nem.lacerta.source.database.entity.DocumentEntity; +import one.nem.lacerta.source.database.entity.LibraryEntity; import one.nem.lacerta.source.database.entity.TagEntity; @@ -43,7 +45,21 @@ public class DocumentImpl implements Document{ DocumentDetail documentDetail = new DocumentDetail(); DocumentEntity documentEntity = database.documentDao().findById(id); + // タグデータ作成 ArrayList tagEntities = database.tagDao().findByIds(documentEntity.tagIds); + ArrayList documentTags = new ArrayList<>(); + for (TagEntity tagEntity : tagEntities) { + DocumentTag documentTag = new DocumentTag(); + documentTag.setId(tagEntity.id); + documentTag.setName(tagEntity.tagName); + documentTag.setColor(tagEntity.color); + documentTags.add(documentTag); + } + + // パス取得 + LibraryEntity libraryEntity = database.libraryDao().findById(id) + DocumentPath documentPath = new DocumentPath(libraryEntity.rootPath, libraryEntity.path); + // 組み立て処理 // TODO-rca: 切り出すべきかも? DocumentMeta documentMeta = new DocumentMeta(); @@ -51,6 +67,10 @@ public class DocumentImpl implements Document{ documentMeta.setTitle(documentEntity.title); documentMeta.setCreatedAt(documentEntity.createdAt); documentMeta.setUpdatedAt(documentEntity.updatedAt); + documentMeta.setTags(documentTags); + documentDetail.setMeta(documentMeta); + documentDetail.setAuthor(documentEntity.author); + documentDetail.setPath(new DocumentPath(documentEntity.defaultBranch)); }