From 8acbe6338bff50e635d5cf7047644e4a5f0a7e29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 26 Jan 2024 15:26:04 +0900 Subject: [PATCH] =?UTF-8?q?ID=E3=81=8C=E6=8C=87=E5=AE=9A=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AB?= =?UTF-8?q?=E8=87=AA=E5=8B=95=E3=81=A7=E7=94=9F=E6=88=90=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java | 4 ++++ 1 file changed, 4 insertions(+) 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 88ef000f..816bf706 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 @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.UUID; import java.util.concurrent.CompletableFuture; @@ -244,6 +245,9 @@ public class LacertaLibraryImpl implements LacertaLibrary { public CompletableFuture createTag(DocumentTag tag) { return CompletableFuture.supplyAsync(() -> { TagEntity tagEntity = convertDocumentTagToTagEntity(tag); + if (Objects.isNull(tagEntity.id) || tagEntity.id.isEmpty()) { + tagEntity.id = UUID.randomUUID().toString(); + } database.tagDao().insert(tagEntity); logger.debug("LacertaLibraryImpl", "Database Query: Inserted TagEntity (" + tag.getId() + ")"); return null;