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(() -> {