getAppliedTagList実装

This commit is contained in:
r-ca 2024-01-28 16:27:24 +09:00
parent 23489e20c6
commit 6ed09e6103
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9
2 changed files with 18 additions and 0 deletions

View File

@ -35,6 +35,8 @@ public interface LacertaLibrary {
// Tag
CompletableFuture<ArrayList<DocumentTag>> getTagList();
CompletableFuture<ArrayList<DocumentTag>> getAppliedTagList(String documentId);
CompletableFuture<Void> createTag(DocumentTag tag);
CompletableFuture<Void> updateTag(DocumentTag tag);

View File

@ -248,6 +248,22 @@ public class LacertaLibraryImpl implements LacertaLibrary {
});
}
@Override
public CompletableFuture<ArrayList<DocumentTag>> getAppliedTagList(String documentId) {
return CompletableFuture.supplyAsync(() -> {
List<ToxiDocumentTagEntity> toxiDocumentTagEntities = database.toxiDocumentTagDao().findByDocumentId(documentId);
logger.debug("LacertaLibraryImpl", "Database Query: Get ToxiDocumentTagEntity List (Size: " + toxiDocumentTagEntities.size() + ")");
ArrayList<DocumentTag> 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<Void> createTag(DocumentTag tag) {
return CompletableFuture.supplyAsync(() -> {