uncombineDocument実装

This commit is contained in:
r-ca 2024-01-28 09:06:56 +09:00
parent cd784cad15
commit 0a98cfd8a5
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -321,8 +321,24 @@ public class LacertaLibraryImpl implements LacertaLibrary {
@Override @Override
public CompletableFuture<Void> uncombineDocument(String parentId, String childId) { public CompletableFuture<Void> uncombineDocument(String parentId, String childId) {
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; return null;
} }
parentDocumentEntity.isCombineParent = false;
childDocumentEntity.isCombineChild = false;
database.documentDao().update(parentDocumentEntity);
database.documentDao().update(childDocumentEntity);
logger.debug("LacertaLibraryImpl", "Database Query: Updated DocumentEntity");
database.toxiDocumentDao().deleteByParentIdAndChildId(parentId, childId);
logger.debug("LacertaLibraryImpl", "Database Query: Deleted ToxiDocumentEntity");
return null;
});
}
@Override @Override
public CompletableFuture<ArrayList<DocumentDetail>> getCombinedDocumentList(String parentId) { public CompletableFuture<ArrayList<DocumentDetail>> getCombinedDocumentList(String parentId) {