DocumentDetail取得するロジック書いた

This commit is contained in:
ろむねこ 2023-12-14 11:28:59 +09:00
parent fe843e0429
commit 028a00bde6
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -46,7 +46,8 @@ public class DocumentImpl implements Document{
DocumentDetail documentDetail = new DocumentDetail(); DocumentDetail documentDetail = new DocumentDetail();
DocumentEntity documentEntity = database.documentDao().findById(id); DocumentEntity documentEntity = database.documentDao().findById(id);
// タグデータ作成 // タグ取得
// TODO-rca: 切り出すべきかも
List<TagEntity> tagEntities = database.tagDao().findByIds(documentEntity.tagIds); List<TagEntity> tagEntities = database.tagDao().findByIds(documentEntity.tagIds);
ArrayList<DocumentTag> documentTags = new ArrayList<>(); ArrayList<DocumentTag> documentTags = new ArrayList<>();
for (TagEntity tagEntity : tagEntities) { for (TagEntity tagEntity : tagEntities) {
@ -58,7 +59,8 @@ public class DocumentImpl implements Document{
} }
// パス取得 // パス取得
LibraryEntity libraryEntity = database.libraryDao().findById(id) // TODO-rca: 切り出すべきかも
LibraryEntity libraryEntity = database.libraryDao().findById(id);
DocumentPath documentPath = new DocumentPath(libraryEntity.rootPath, libraryEntity.path); DocumentPath documentPath = new DocumentPath(libraryEntity.rootPath, libraryEntity.path);
// 組み立て処理 // 組み立て処理
@ -71,9 +73,10 @@ public class DocumentImpl implements Document{
documentMeta.setTags(documentTags); documentMeta.setTags(documentTags);
documentDetail.setMeta(documentMeta); documentDetail.setMeta(documentMeta);
documentDetail.setAuthor(documentEntity.author); documentDetail.setAuthor(documentEntity.author);
documentDetail.setPath(new DocumentPath(documentEntity.defaultBranch)); documentDetail.setPath(documentPath);
documentDetail.setDefaultBranch(documentEntity.defaultBranch);
return documentDetail;
} }
@Override @Override