applyTagListToDocument実装

This commit is contained in:
r-ca 2024-01-29 01:17:46 +09:00
parent b32ce60ad8
commit 1e0ba33519
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9
2 changed files with 16 additions and 0 deletions

View File

@ -45,6 +45,8 @@ public interface LacertaLibrary {
CompletableFuture<Void> addTagToDocument(String documentId, String tagId); CompletableFuture<Void> addTagToDocument(String documentId, String tagId);
CompletableFuture<Void> applyTagListToDocument(String documentId, ArrayList<DocumentTag> tagList);
CompletableFuture<Void> removeTagFromDocument(String documentId, String tagId); CompletableFuture<Void> removeTagFromDocument(String documentId, String tagId);
// Combined Document // Combined Document

View File

@ -321,6 +321,20 @@ public class LacertaLibraryImpl implements LacertaLibrary {
}); });
} }
@Override
public CompletableFuture<Void> applyTagListToDocument(String documentId, ArrayList<DocumentTag> tagArrayList) {
return CompletableFuture.supplyAsync(() -> { // TODO-rca: 必要なものだけInsertするべき, 時間があれば...
// 一旦全てのタグを削除
database.toxiDocumentTagDao().deleteByDocumentId(documentId);
logger.debug("LacertaLibraryImpl", "Database Query: Deleted ToxiDocumentTagEntity");
// タグを追加
for (DocumentTag documentTag : tagArrayList) {
addTagToDocument(documentId, documentTag.getId());
}
return null;
});
}
@Override @Override
public CompletableFuture<Void> removeTagFromDocument(String documentId, String tagId) { public CompletableFuture<Void> removeTagFromDocument(String documentId, String tagId) {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {