From fc1c8f66cc622965d4964e8833caf8b3a58e5a3e Mon Sep 17 00:00:00 2001 From: r-ca Date: Wed, 24 Jan 2024 15:53:46 +0900 Subject: [PATCH] =?UTF-8?q?=E5=AE=9F=E8=A3=85=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/vcs/LacertaVcs.java | 2 +- .../nem/lacerta/vcs/impl/LacertaVcsImpl.java | 24 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/vcs/src/main/java/one/nem/lacerta/vcs/LacertaVcs.java b/vcs/src/main/java/one/nem/lacerta/vcs/LacertaVcs.java index 5231f294..1db26d6a 100644 --- a/vcs/src/main/java/one/nem/lacerta/vcs/LacertaVcs.java +++ b/vcs/src/main/java/one/nem/lacerta/vcs/LacertaVcs.java @@ -26,7 +26,7 @@ public interface LacertaVcs { public CompletableFuture> getLogHistoryInRev(String revId); - public CompletableFuture> getDocumentDetailAtRev(String revId); + public CompletableFuture getDocumentDetailAtRev(String revId); // debug diff --git a/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java b/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java index 6bc1093a..a9fd0709 100644 --- a/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java +++ b/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java @@ -13,7 +13,9 @@ import dagger.assisted.AssistedInject; import one.nem.lacerta.model.VcsLogModel; import one.nem.lacerta.model.VcsRevModel; import one.nem.lacerta.model.document.DocumentDetail; +import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.source.database.LacertaDatabase; +import one.nem.lacerta.source.database.entity.DocumentEntity; import one.nem.lacerta.source.database.entity.VcsLogEntity; import one.nem.lacerta.source.database.entity.VcsRevEntity; import one.nem.lacerta.utils.LacertaLogger; @@ -212,12 +214,32 @@ public class LacertaVcsImpl implements LacertaVcs { return vcsLogEntities; } + private DocumentMeta createDocumentMeta() { + DocumentMeta documentMeta = new DocumentMeta(); + DocumentEntity documentEntity = database.documentDao().findById(documentId); + documentMeta.setId(documentEntity.id); + documentMeta.setCreatedAt(documentEntity.createdAt); + documentMeta.setUpdatedAt(documentEntity.updatedAt); + documentMeta.setDefaultBranch(documentEntity.defaultBranch); + documentMeta.setAuthor(documentEntity.author); + documentMeta.setParentId(documentEntity.parentId); + documentMeta.setTitle(documentEntity.title); + documentMeta.setTags(new ArrayList<>()); // TODO-rca: タグの実装 + + return documentMeta; + } + @Override - public CompletableFuture> getDocumentDetailAtRev(String revId) { + public CompletableFuture getDocumentDetailAtRev(String revId) { return CompletableFuture.supplyAsync(() -> { ArrayList vcsRevEntities = getRevBeforeTargetId(revId); + ArrayList vcsLogEntities = getLogInRevs(vcsRevEntities); + DocumentDetail documentDetail = new DocumentDetail(); + documentDetail.setMeta(createDocumentMeta()); + // WIP + return null; }); }