mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 07:53:15 +00:00
正常に遡れない問題を修正
This commit is contained in:
parent
17590660c7
commit
282c09bbd1
|
@ -1,6 +1,7 @@
|
||||||
package one.nem.lacerta.vcs.impl;
|
package one.nem.lacerta.vcs.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
@ -195,16 +196,20 @@ public class LacertaVcsImpl implements LacertaVcs {
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompletableFuture<ArrayList<VcsRevEntity>> getRevBeforeTargetIdAsync(String revId){
|
private CompletableFuture<ArrayList<VcsRevEntity>> getRevBeforeTargetIdAsync(String revId){
|
||||||
|
logger.debug(TAG, "getRevBeforeTargetIdAsync called: " + revId);
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
ArrayList<VcsRevEntity> vcsRevEntities = new ArrayList<>(database.vcsRevDao().findByDocumentId(this.documentId));
|
ArrayList<VcsRevEntity> vcsRevEntities = new ArrayList<>(database.vcsRevDao().findByDocumentId(this.documentId));
|
||||||
|
// 古い順に並び替え
|
||||||
|
vcsRevEntities.sort(Comparator.comparing(a -> a.createdAt));
|
||||||
ArrayList<VcsRevEntity> vcsRevEntitiesBeforeTarget = new ArrayList<>();
|
ArrayList<VcsRevEntity> vcsRevEntitiesBeforeTarget = new ArrayList<>();
|
||||||
vcsRevEntities.forEach(vcsRevEntity -> {
|
for (VcsRevEntity vcsRevEntity : vcsRevEntities) {
|
||||||
if(vcsRevEntity.id.equals(revId)){
|
if(vcsRevEntity.id.equals(revId)){
|
||||||
|
logger.debug(TAG, "getRevBeforeTargetIdAsync: Target found");
|
||||||
vcsRevEntitiesBeforeTarget.add(vcsRevEntity);
|
vcsRevEntitiesBeforeTarget.add(vcsRevEntity);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
vcsRevEntitiesBeforeTarget.add(vcsRevEntity);
|
vcsRevEntitiesBeforeTarget.add(vcsRevEntity);
|
||||||
});
|
}
|
||||||
logger.debug(TAG, "getRevBeforeTargetIdAsync finished\nResult size: " + vcsRevEntitiesBeforeTarget.size());
|
logger.debug(TAG, "getRevBeforeTargetIdAsync finished\nResult size: " + vcsRevEntitiesBeforeTarget.size());
|
||||||
return vcsRevEntitiesBeforeTarget;
|
return vcsRevEntitiesBeforeTarget;
|
||||||
});
|
});
|
||||||
|
@ -216,8 +221,8 @@ public class LacertaVcsImpl implements LacertaVcs {
|
||||||
vcsRevEntities.forEach(vcsRevEntity -> {
|
vcsRevEntities.forEach(vcsRevEntity -> {
|
||||||
logIds.addAll(vcsRevEntity.logIds);
|
logIds.addAll(vcsRevEntity.logIds);
|
||||||
});
|
});
|
||||||
// TODO-rca: ソートしないといけないかも(順番が保証されているわけではない + 順番が変わるとほぼ確実に壊れる)
|
|
||||||
ArrayList<VcsLogEntity> vcsLogEntities = new ArrayList<>(database.vcsLogDao().findByIds(logIds));
|
ArrayList<VcsLogEntity> vcsLogEntities = new ArrayList<>(database.vcsLogDao().findByIds(logIds));
|
||||||
|
vcsLogEntities.sort(Comparator.comparing(a -> a.createdAt));
|
||||||
logger.debug(TAG, "getLogInRevsAsync finished\nResult size: " + vcsLogEntities.size());
|
logger.debug(TAG, "getLogInRevsAsync finished\nResult size: " + vcsLogEntities.size());
|
||||||
return vcsLogEntities;
|
return vcsLogEntities;
|
||||||
});
|
});
|
||||||
|
@ -235,7 +240,13 @@ public class LacertaVcsImpl implements LacertaVcs {
|
||||||
public CompletableFuture<ArrayList<String>> getDocumentPagePathListRev(String revId) {
|
public CompletableFuture<ArrayList<String>> getDocumentPagePathListRev(String revId) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
logger.debug(TAG, "getDocumentPagePathListRev");
|
logger.debug(TAG, "getDocumentPagePathListRev");
|
||||||
ArrayList<VcsLogEntity> vcsLogEntities = getRevBeforeTargetIdAsync(revId).thenCompose(this::getLogInRevsAsync).join();
|
ArrayList<VcsRevEntity> vcsRevEntities = getRevBeforeTargetIdAsync(revId).join();
|
||||||
|
|
||||||
|
logger.debug(TAG, "getDocumentPagePathListRev: vcsRevEntities size: " + vcsRevEntities.size());
|
||||||
|
|
||||||
|
ArrayList<VcsLogEntity> vcsLogEntities = getLogInRevsAsync(vcsRevEntities).join();
|
||||||
|
|
||||||
|
logger.debug(TAG, "getDocumentPagePathListRev: vcsLogEntities size: " + vcsLogEntities.size());
|
||||||
|
|
||||||
ArrayList<String> fileNameList = new ArrayList<>();
|
ArrayList<String> fileNameList = new ArrayList<>();
|
||||||
for(VcsLogEntity vcsLogEntity : vcsLogEntities){
|
for(VcsLogEntity vcsLogEntity : vcsLogEntities){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user