From 6ed09e6103fa38e0f2bb1682779d164d96ea47af Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 16:27:24 +0900 Subject: [PATCH] =?UTF-8?q?getAppliedTagList=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/data/LacertaLibrary.java | 2 ++ .../lacerta/data/impl/LacertaLibraryImpl.java | 16 ++++++++++++++++ 2 files changed, 18 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 7e8ba899..764dcb5a 100644 --- a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java +++ b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java @@ -35,6 +35,8 @@ public interface LacertaLibrary { // Tag CompletableFuture> getTagList(); + CompletableFuture> getAppliedTagList(String documentId); + CompletableFuture createTag(DocumentTag tag); CompletableFuture updateTag(DocumentTag tag); 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 e6c19bd9..b0052b70 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 @@ -248,6 +248,22 @@ public class LacertaLibraryImpl implements LacertaLibrary { }); } + @Override + public CompletableFuture> getAppliedTagList(String documentId) { + return CompletableFuture.supplyAsync(() -> { + List toxiDocumentTagEntities = database.toxiDocumentTagDao().findByDocumentId(documentId); + logger.debug("LacertaLibraryImpl", "Database Query: Get ToxiDocumentTagEntity List (Size: " + toxiDocumentTagEntities.size() + ")"); + ArrayList documentTags = new ArrayList<>(); + for (ToxiDocumentTagEntity toxiDocumentTagEntity : toxiDocumentTagEntities) { + TagEntity tagEntity = database.tagDao().findById(toxiDocumentTagEntity.tagId); + if (tagEntity != null) { + documentTags.add(convertTagEntityToDocumentTag(tagEntity)); + } + } + return documentTags; + }); + } + @Override public CompletableFuture createTag(DocumentTag tag) { return CompletableFuture.supplyAsync(() -> {