RED-8706: includedeleted not working #418

Merged
yannik.hampe merged 1 commits from RED-8706 into master 2024-04-03 13:45:36 +02:00
2 changed files with 5 additions and 2 deletions

View File

@ -275,6 +275,9 @@ public class DictionaryManagementService {
public void checkForDossierTypeExistenceAndCreate(String typeId) {
checkForDossierTypeExistenceAndCreate(typeId,false);
}
public void checkForDossierTypeExistenceAndCreate(String typeId, boolean includeDeleted) {
// check for the existence of dossier type and create in case it does not exist
if (isDossierTypeId(typeId)) {
try {
@ -286,7 +289,7 @@ public class DictionaryManagementService {
log.info("--> " + dossierId + " - " + dossierTemplateId);
checkDossierMatchesDossierTemplate(dossierId, dossierTemplateId);
// type not found, it should be created based on the info from the dossier template type
var dossierTemplateType = dictionaryPersistenceService.getType(getDosssierTemplateTypeIdFromTypeId(typeId));
var dossierTemplateType = dictionaryPersistenceService.getType(getDosssierTemplateTypeIdFromTypeId(typeId),includeDeleted);
Type dossierDictionaryType = MagicConverter.convert(dossierTemplateType, Type.class);
dossierDictionaryType.setVersion(0);
dossierDictionaryType.setDossierId(dossierId);

View File

@ -227,7 +227,7 @@ public class DictionaryService {
accessControlService.verifyUserHasViewPermissions(dossierId);
dictionaryManagementService.checkDossierMatchesDossierTemplate(dossierId, dossierTemplateId);
// for every dossier template type check if a dossier type exists
types.forEach(t -> dictionaryManagementService.checkForDossierTypeExistenceAndCreate(toTypeId(t.getType(), t.getDossierTemplateId(), dossierId)));
types.forEach(t -> dictionaryManagementService.checkForDossierTypeExistenceAndCreate(toTypeId(t.getType(), t.getDossierTemplateId(), dossierId),includeDeleted));
types.addAll(MagicConverter.convert(dictionaryPersistenceService.getAllTypesForDossier(dossierId, includeDeleted), Type.class));
} catch (AccessDeniedException e) {
log.debug(" Don't include the types for the dossier id");