RED-6929: Fixed transaction handline for manual redaction add to dictionary #19
@ -13,6 +13,8 @@ import java.util.function.Predicate;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -223,6 +225,7 @@ public class DictionaryManagementService {
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void addEntries(String typeId, List<String> entries, boolean removeCurrent, boolean ignoreInvalidEntries, DictionaryEntryType dictionaryEntryType) {
|
||||
|
||||
checkForDossierTypeExistenceAndCreate(typeId);
|
||||
|
||||
@ -93,7 +93,7 @@ public class DossierTemplateCloneService {
|
||||
|
||||
clonedDossierTemplate.setDossierTemplateStatus(DossierTemplateStatus.valueOf(dossierTemplatePersistenceService.computeDossierTemplateStatus(clonedDossierTemplate)
|
||||
.name()));
|
||||
dossierTemplateRepository.save(clonedDossierTemplate);
|
||||
dossierTemplatePersistenceService.insertDossierTemplate(clonedDossierTemplate);
|
||||
|
||||
//set dictionaries
|
||||
cloneDictionariesWithEntries(dossierTemplate.getId(), clonedDossierTemplate.getId());
|
||||
|
||||
@ -93,6 +93,7 @@ public class ManualRedactionService {
|
||||
private final HashFunction hashFunction = Hashing.murmur3_128();
|
||||
|
||||
|
||||
@Transactional
|
||||
public List<ManualAddResponse> addAddRedaction(String dossierId, String fileId, List<AddRedactionRequest> addRedactionRequests) {
|
||||
|
||||
var response = new ArrayList<ManualAddResponse>();
|
||||
|
||||
@ -36,7 +36,7 @@ public class DictionaryPersistenceService {
|
||||
private final EntryRepository entryRepository;
|
||||
|
||||
|
||||
@Transactional
|
||||
@Transactional(Transactional.TxType.REQUIRES_NEW) // This needs a single transaction because of the creation of types on the fly, otherwise add entries will fails
|
||||
public TypeEntity addType(String type,
|
||||
String dossierTemplateId,
|
||||
String hexColor,
|
||||
|
||||
@ -164,4 +164,12 @@ public class DossierTemplatePersistenceService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRES_NEW)
|
||||
public void insertDossierTemplate(DossierTemplateEntity dossierTemplate){
|
||||
dossierTemplateRepository.saveAndFlush(dossierTemplate);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -81,6 +81,7 @@ public class EntryPersistenceService {
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void deleteAllEntriesForTypeId(String typeId, long version, DictionaryEntryType dictionaryEntryType) {
|
||||
|
||||
switch (dictionaryEntryType) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user