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 20b3c6bd..5231f294 100644 --- a/vcs/src/main/java/one/nem/lacerta/vcs/LacertaVcs.java +++ b/vcs/src/main/java/one/nem/lacerta/vcs/LacertaVcs.java @@ -6,7 +6,6 @@ import java.util.concurrent.CompletableFuture; import one.nem.lacerta.model.VcsLogModel; import one.nem.lacerta.model.VcsRevModel; import one.nem.lacerta.model.document.DocumentDetail; -import one.nem.lacerta.source.database.entity.VcsLogEntity; public interface LacertaVcs { @@ -25,6 +24,8 @@ public interface LacertaVcs { public CompletableFuture> getLogHistory(); + public CompletableFuture> getLogHistoryInRev(String revId); + public CompletableFuture> getDocumentDetailAtRev(String revId); 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 6779df46..2bb23258 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 @@ -154,6 +154,28 @@ public class LacertaVcsImpl implements LacertaVcs { return null; } + @Override + public CompletableFuture> getLogHistoryInRev(String revId) { + return CompletableFuture.supplyAsync(() -> { + logger.debug(TAG, "getLogHistoryAtRev"); + ArrayList vcsLogModels = new ArrayList<>(); + + VcsRevEntity vcsRevEntity = database.vcsRevDao().findById(revId); + vcsRevEntity.logIds.forEach(logId -> { + VcsLogEntity vcsLogEntity = database.vcsLogDao().findById(logId); + VcsLogModel vcsLogModel = new VcsLogModel(); + vcsLogModel.setId(vcsLogEntity.id); + vcsLogModel.setDocumentId(vcsLogEntity.documentId); + vcsLogModel.setBranchName(vcsLogEntity.branchName); + vcsLogModel.setCreatedAt(vcsLogEntity.createdAt); + vcsLogModel.setAction(vcsLogEntity.action); + vcsLogModels.add(vcsLogModel); + }); + + return vcsLogModels; + }); + } + @Override public CompletableFuture> getDocumentDetailAtRev(String revId) { return null;