This commit is contained in:
r-ca 2023-12-16 16:28:30 +09:00
parent 5f6d4df5b2
commit 12537b3506
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -18,6 +18,8 @@ import one.nem.lacerta.source.database.entity.DocumentEntity;
import one.nem.lacerta.source.database.entity.LibraryEntity; import one.nem.lacerta.source.database.entity.LibraryEntity;
import one.nem.lacerta.source.database.entity.TagEntity; import one.nem.lacerta.source.database.entity.TagEntity;
import one.nem.lacerta.source.jgit.JGitRepository;
public class DocumentImpl implements Document{ public class DocumentImpl implements Document{
@ -28,6 +30,8 @@ public class DocumentImpl implements Document{
this.database = database; this.database = database;
} }
@Inject
JGitRepository jGitRepository;
@Override @Override
public ArrayList<DocumentMeta> getRecentDocumentMetas(int limit) { public ArrayList<DocumentMeta> getRecentDocumentMetas(int limit) {
@ -60,14 +64,18 @@ public class DocumentImpl implements Document{
LibraryEntity libraryEntity = database.libraryDao().findById(id); LibraryEntity libraryEntity = database.libraryDao().findById(id);
DocumentPath documentPath = new DocumentPath(libraryEntity.rootPath, libraryEntity.path); DocumentPath documentPath = new DocumentPath(libraryEntity.rootPath, libraryEntity.path);
// リポジトリ取得
jGitRepository.getRepository(id);
// 組み立て処理 // 組み立て処理
// TODO-rca: 切り出すべきかも? // 可読性が終わるのでコンストラクタはつかわないほうがいいかも
DocumentMeta documentMeta = new DocumentMeta(); DocumentMeta documentMeta = new DocumentMeta();
documentMeta.setId(documentEntity.id); documentMeta.setId(documentEntity.id);
documentMeta.setTitle(documentEntity.title); documentMeta.setTitle(documentEntity.title);
documentMeta.setCreatedAt(documentEntity.createdAt); documentMeta.setCreatedAt(documentEntity.createdAt);
documentMeta.setUpdatedAt(documentEntity.updatedAt); documentMeta.setUpdatedAt(documentEntity.updatedAt);
documentMeta.setTags(documentTags); documentMeta.setTags(documentTags);
documentDetail.setMeta(documentMeta); documentDetail.setMeta(documentMeta);
documentDetail.setAuthor(documentEntity.author); documentDetail.setAuthor(documentEntity.author);
documentDetail.setPath(documentPath); documentDetail.setPath(documentPath);