mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
IDが指定されなかった場合に自動で生成するように
This commit is contained in:
parent
2f9df5a225
commit
8acbe6338b
|
@ -9,6 +9,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
@ -244,6 +245,9 @@ public class LacertaLibraryImpl implements LacertaLibrary {
|
||||||
public CompletableFuture<Void> createTag(DocumentTag tag) {
|
public CompletableFuture<Void> createTag(DocumentTag tag) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
TagEntity tagEntity = convertDocumentTagToTagEntity(tag);
|
TagEntity tagEntity = convertDocumentTagToTagEntity(tag);
|
||||||
|
if (Objects.isNull(tagEntity.id) || tagEntity.id.isEmpty()) {
|
||||||
|
tagEntity.id = UUID.randomUUID().toString();
|
||||||
|
}
|
||||||
database.tagDao().insert(tagEntity);
|
database.tagDao().insert(tagEntity);
|
||||||
logger.debug("LacertaLibraryImpl", "Database Query: Inserted TagEntity (" + tag.getId() + ")");
|
logger.debug("LacertaLibraryImpl", "Database Query: Inserted TagEntity (" + tag.getId() + ")");
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user