actionを追加するように WIP

This commit is contained in:
ろむねこ 2024-01-17 11:25:41 +09:00
parent 74becab37b
commit 744a2bef65
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -12,7 +12,10 @@ import one.nem.lacerta.source.database.LacertaDatabase;
import one.nem.lacerta.source.database.entity.VcsLogEntity; import one.nem.lacerta.source.database.entity.VcsLogEntity;
import one.nem.lacerta.source.database.entity.VcsRevEntity; import one.nem.lacerta.source.database.entity.VcsRevEntity;
import one.nem.lacerta.utils.LacertaLogger; import one.nem.lacerta.utils.LacertaLogger;
import one.nem.lacerta.vcs.ActionType;
import one.nem.lacerta.vcs.LacertaVcs; import one.nem.lacerta.vcs.LacertaVcs;
import one.nem.lacerta.vcs.internal.JsonUtils;
import one.nem.lacerta.vcs.model.action.InsertPage;
public class LacertaVcsImpl implements LacertaVcs { public class LacertaVcsImpl implements LacertaVcs {
@ -41,12 +44,17 @@ public class LacertaVcsImpl implements LacertaVcs {
@Override @Override
public void insertPage(int index, String fileName) { public void insertPage(int index, String fileName) {
logger.debug(TAG, "insertPage"); logger.debug(TAG, "insertPage");
// InsertPage
InsertPage insertPage = new InsertPage(index, fileName);
insertPage.setActionType(ActionType.INSERT_PAGE);
VcsLogEntity vcsLogEntity = new VcsLogEntity(); VcsLogEntity vcsLogEntity = new VcsLogEntity();
vcsLogEntity.id = UUID.randomUUID().toString(); vcsLogEntity.id = UUID.randomUUID().toString();
vcsLogEntity.documentId = documentId; vcsLogEntity.documentId = documentId;
vcsLogEntity.branchName = "master"; vcsLogEntity.branchName = "master";
vcsLogEntity.createdAt = new java.util.Date(); vcsLogEntity.createdAt = new java.util.Date();
vcsLogEntity.action = "placeholder"; vcsLogEntity.action = JsonUtils.toJson(insertPage);
database.vcsLogDao().insert(vcsLogEntity); database.vcsLogDao().insert(vcsLogEntity);
} }
@ -58,12 +66,13 @@ public class LacertaVcsImpl implements LacertaVcs {
@Override @Override
public void createDocument(String documentId) { public void createDocument(String documentId) {
logger.debug(TAG, "createDocument"); logger.debug(TAG, "createDocument");
VcsLogEntity vcsLogEntity = new VcsLogEntity(); VcsLogEntity vcsLogEntity = new VcsLogEntity();
vcsLogEntity.id = UUID.randomUUID().toString(); vcsLogEntity.id = UUID.randomUUID().toString();
vcsLogEntity.documentId = documentId; vcsLogEntity.documentId = documentId;
vcsLogEntity.branchName = "master"; vcsLogEntity.branchName = "master";
vcsLogEntity.createdAt = new java.util.Date(); vcsLogEntity.createdAt = new java.util.Date();
vcsLogEntity.action = "placeholder"; vcsLogEntity.action = "ph-createDocument";
database.vcsLogDao().insert(vcsLogEntity); database.vcsLogDao().insert(vcsLogEntity);
} }
@ -118,6 +127,8 @@ public class LacertaVcsImpl implements LacertaVcs {
logger.debug(TAG, "printLog"); logger.debug(TAG, "printLog");
database.vcsLogDao().findAll().forEach(vcsLog -> { database.vcsLogDao().findAll().forEach(vcsLog -> {
logger.debug(TAG, vcsLog.id); logger.debug(TAG, vcsLog.id);
logger.debug(TAG, vcsLog.documentId + " " + vcsLog.branchName);
logger.debug(TAG, vcsLog.action);
}); });
} }
@ -126,6 +137,9 @@ public class LacertaVcsImpl implements LacertaVcs {
logger.debug(TAG, "printRev"); logger.debug(TAG, "printRev");
database.vcsRevDao().findAll().forEach(vcsRev -> { database.vcsRevDao().findAll().forEach(vcsRev -> {
logger.debug(TAG, vcsRev.id); logger.debug(TAG, vcsRev.id);
logger.debug(TAG, vcsRev.documentId + " " + vcsRev.branchName);
logger.debug(TAG, vcsRev.commitMessage);
logger.debug(TAG, vcsRev.logIds.toString());
}); });
} }
} }