mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
combineDocument実装
This commit is contained in:
parent
68635e2f12
commit
cd784cad15
|
@ -27,6 +27,7 @@ import one.nem.lacerta.source.database.common.DateTypeConverter;
|
||||||
import one.nem.lacerta.source.database.entity.DocumentEntity;
|
import one.nem.lacerta.source.database.entity.DocumentEntity;
|
||||||
import one.nem.lacerta.source.database.entity.FolderEntity;
|
import one.nem.lacerta.source.database.entity.FolderEntity;
|
||||||
import one.nem.lacerta.source.database.entity.TagEntity;
|
import one.nem.lacerta.source.database.entity.TagEntity;
|
||||||
|
import one.nem.lacerta.source.database.entity.ToxiDocumentEntity;
|
||||||
import one.nem.lacerta.source.database.entity.ToxiDocumentTagEntity;
|
import one.nem.lacerta.source.database.entity.ToxiDocumentTagEntity;
|
||||||
import one.nem.lacerta.utils.FeatureSwitch;
|
import one.nem.lacerta.utils.FeatureSwitch;
|
||||||
import one.nem.lacerta.utils.LacertaLogger;
|
import one.nem.lacerta.utils.LacertaLogger;
|
||||||
|
@ -296,7 +297,26 @@ public class LacertaLibraryImpl implements LacertaLibrary {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Void> combineDocument(String parentId, String childId) {
|
public CompletableFuture<Void> combineDocument(String parentId, String childId) {
|
||||||
return null;
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
|
DocumentEntity parentDocumentEntity = database.documentDao().findById(parentId);
|
||||||
|
DocumentEntity childDocumentEntity = database.documentDao().findById(childId);
|
||||||
|
if (parentDocumentEntity == null || childDocumentEntity == null) {
|
||||||
|
logger.warn("LacertaLibraryImpl", "DocumentEntity is not found.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
parentDocumentEntity.isCombineParent = true;
|
||||||
|
childDocumentEntity.isCombineChild = true;
|
||||||
|
database.documentDao().update(parentDocumentEntity);
|
||||||
|
database.documentDao().update(childDocumentEntity);
|
||||||
|
logger.debug("LacertaLibraryImpl", "Database Query: Updated DocumentEntity");
|
||||||
|
|
||||||
|
ToxiDocumentEntity toxiDocumentEntity = new ToxiDocumentEntity();
|
||||||
|
toxiDocumentEntity.parentDocumentId = parentId;
|
||||||
|
toxiDocumentEntity.childDocumentId = childId;
|
||||||
|
database.toxiDocumentDao().insert(toxiDocumentEntity);
|
||||||
|
logger.debug("LacertaLibraryImpl", "Database Query: Inserted ToxiDocumentEntity");
|
||||||
|
return null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user