Skip to content

Commit

Permalink
chore: add logs and force transactional on addFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien committed Jul 5, 2024
1 parent 0d15416 commit 97c1fe6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@
import fr.dossierfacile.api.front.model.tenant.TenantModel;
import fr.dossierfacile.api.front.register.form.DocumentForm;
import fr.dossierfacile.api.front.service.interfaces.DocumentService;
import fr.dossierfacile.common.enums.LogType;
import fr.dossierfacile.common.utils.TransactionalUtil;
import fr.dossierfacile.common.entity.Document;
import fr.dossierfacile.common.entity.Tenant;
import fr.dossierfacile.common.enums.LogType;
import fr.dossierfacile.common.enums.PartnerCallBackType;
import fr.dossierfacile.common.enums.TenantFileStatus;
import fr.dossierfacile.common.model.log.EditionType;
import fr.dossierfacile.common.repository.TenantCommonRepository;
import fr.dossierfacile.common.service.interfaces.LogService;
import fr.dossierfacile.common.service.interfaces.PartnerCallBackService;
import fr.dossierfacile.common.utils.TransactionalUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.io.IOException;

@RequiredArgsConstructor
@Slf4j
public abstract class AbstractDocumentSaveStep<T extends DocumentForm> implements SaveStep<T> {
Expand Down Expand Up @@ -69,8 +67,8 @@ protected final void saveFiles(DocumentForm documentForm, Document document) {
try {
// TODO -> We must find a way to inform user there is a failure
documentService.addFile(file, document);
} catch (IOException ioe) {
log.error("Unable to add File ", ioe);
} catch (Exception ioe) {
log.error("Unable to add File to document {}", document.getId(), ioe);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void resetValidatedOrInProgressDocumentsAccordingCategories(List<Document
});
}

@Transactional(propagation = Propagation.SUPPORTS)
@Transactional
@Override
public void addFile(MultipartFile multipartFile, Document document) throws IOException {
File file = documentHelperService.addFile(multipartFile, document);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class DocumentHelperServiceImpl implements DocumentHelperService {
private final SharedFileRepository fileRepository;
private final EncryptionKeyService encryptionKeyService;

@Transactional(propagation = Propagation.SUPPORTS)
@Transactional
@Override
public File addFile(MultipartFile multipartFile, Document document) throws IOException {

Expand Down

0 comments on commit 97c1fe6

Please sign in to comment.