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 446758e3..e1ce346e 100644 --- a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java +++ b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java @@ -53,6 +53,8 @@ public interface LacertaLibrary { CompletableFuture combineDocument(String parentId, String childId); + CompletableFuture updateTitleCache(String parentId, String childId, String titleCache); + CompletableFuture uncombineDocument(String parentId, String childId); // CompletableFuture combineDocument(String parentId, ArrayList childIdList); 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 b36998a1..f35dee8c 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 @@ -389,6 +389,21 @@ public class LacertaLibraryImpl implements LacertaLibrary { logger.debug("LacertaLibraryImpl", "Database Query: Inserted ToxiDocumentEntity"); } + @Override + public CompletableFuture updateTitleCache(String parentId, String documentId, String titleCache) { + return CompletableFuture.supplyAsync(() -> { + ToxiDocumentEntity toxiDocumentEntity = database.toxiDocumentDao().findByParentIdAndChildId(parentId, documentId); + if (toxiDocumentEntity == null) { + logger.warn("LacertaLibraryImpl", "ToxiDocumentEntity is not found."); + return null; + } + toxiDocumentEntity.titleCache = titleCache; + database.toxiDocumentDao().update(toxiDocumentEntity); + logger.debug("LacertaLibraryImpl", "Database Query: Updated ToxiDocumentEntity"); + return null; + }); + } + @Override public CompletableFuture uncombineDocument(String parentId, String childId) { return CompletableFuture.supplyAsync(() -> {