mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
リファクタリング, 実装いろいろ
This commit is contained in:
parent
dafb49cca0
commit
b6f0a5554a
|
@ -157,12 +157,12 @@ public class LacertaVcsImpl implements LacertaVcs {
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<ArrayList<VcsLogModel>> getLogHistoryInRev(String revId) {
|
public CompletableFuture<ArrayList<VcsLogModel>> getLogHistoryInRev(String revId) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
logger.debug(TAG, "getLogHistoryAtRev");
|
logger.debug(TAG, "getLogHistoryInRev");
|
||||||
ArrayList<VcsLogModel> vcsLogModels = new ArrayList<>();
|
ArrayList<VcsLogModel> vcsLogModels = new ArrayList<>();
|
||||||
|
|
||||||
VcsRevEntity vcsRevEntity = database.vcsRevDao().findById(revId);
|
VcsRevEntity vcsRevEntity = database.vcsRevDao().findById(revId);
|
||||||
vcsRevEntity.logIds.forEach(logId -> {
|
ArrayList<VcsLogEntity> vcsLogEntities = getLogInRev(vcsRevEntity);
|
||||||
VcsLogEntity vcsLogEntity = database.vcsLogDao().findById(logId);
|
vcsLogEntities.forEach(vcsLogEntity -> {
|
||||||
VcsLogModel vcsLogModel = new VcsLogModel();
|
VcsLogModel vcsLogModel = new VcsLogModel();
|
||||||
vcsLogModel.setId(vcsLogEntity.id);
|
vcsLogModel.setId(vcsLogEntity.id);
|
||||||
vcsLogModel.setDocumentId(vcsLogEntity.documentId);
|
vcsLogModel.setDocumentId(vcsLogEntity.documentId);
|
||||||
|
@ -176,9 +176,49 @@ public class LacertaVcsImpl implements LacertaVcs {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ArrayList<VcsRevEntity> getRevBeforeTargetId(String revId){
|
||||||
|
ArrayList<VcsRevEntity> vcsRevEntities = new ArrayList<>(database.vcsRevDao().findByDocumentId(this.documentId));
|
||||||
|
ArrayList<VcsRevEntity> vcsRevEntitiesBeforeTarget = new ArrayList<>();
|
||||||
|
vcsRevEntities.forEach(vcsRevEntity -> {
|
||||||
|
if(vcsRevEntity.id.equals(revId)){
|
||||||
|
vcsRevEntitiesBeforeTarget.add(vcsRevEntity);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vcsRevEntitiesBeforeTarget.add(vcsRevEntity);
|
||||||
|
});
|
||||||
|
|
||||||
|
return vcsRevEntitiesBeforeTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<VcsLogEntity> getLogInRevs(ArrayList<VcsRevEntity> vcsRevEntities){
|
||||||
|
ArrayList<VcsLogEntity> vcsLogEntities = new ArrayList<>();
|
||||||
|
vcsRevEntities.forEach(vcsRevEntity -> {
|
||||||
|
vcsRevEntity.logIds.forEach(logId -> {
|
||||||
|
VcsLogEntity vcsLogEntity = database.vcsLogDao().findById(logId);
|
||||||
|
vcsLogEntities.add(vcsLogEntity);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return vcsLogEntities;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<VcsLogEntity> getLogInRev(VcsRevEntity revEntity) {
|
||||||
|
ArrayList<VcsLogEntity> vcsLogEntities = new ArrayList<>();
|
||||||
|
revEntity.logIds.forEach(logId -> {
|
||||||
|
VcsLogEntity vcsLogEntity = database.vcsLogDao().findById(logId);
|
||||||
|
vcsLogEntities.add(vcsLogEntity);
|
||||||
|
});
|
||||||
|
|
||||||
|
return vcsLogEntities;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<ArrayList<DocumentDetail>> getDocumentDetailAtRev(String revId) {
|
public CompletableFuture<ArrayList<DocumentDetail>> getDocumentDetailAtRev(String revId) {
|
||||||
return null;
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
|
ArrayList<VcsRevEntity> vcsRevEntities = getRevBeforeTargetId(revId);
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user