From 1e0ba33519880122029dabca1addd3ec14daade3 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 29 Jan 2024 01:17:46 +0900 Subject: [PATCH] =?UTF-8?q?applyTagListToDocument=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/data/LacertaLibrary.java | 2 ++ .../nem/lacerta/data/impl/LacertaLibraryImpl.java | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java index 764dcb5a..446758e3 100644 --- a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java +++ b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java @@ -45,6 +45,8 @@ public interface LacertaLibrary { CompletableFuture addTagToDocument(String documentId, String tagId); + CompletableFuture applyTagListToDocument(String documentId, ArrayList tagList); + CompletableFuture removeTagFromDocument(String documentId, String tagId); // Combined Document diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java index 5c65a2af..b36998a1 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java @@ -321,6 +321,20 @@ public class LacertaLibraryImpl implements LacertaLibrary { }); } + @Override + public CompletableFuture applyTagListToDocument(String documentId, ArrayList 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 public CompletableFuture removeTagFromDocument(String documentId, String tagId) { return CompletableFuture.supplyAsync(() -> {