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; }); }