RED-6485 - Dossier-only entity setting in the dossier template, RED-6743 -... #2

Merged
corina.olariu.ext1 merged 6 commits from RED-6485_RED-6743 into master 2023-06-14 10:44:08 +02:00
2 changed files with 7 additions and 9 deletions
Showing only changes of commit 889e63e7c7 - Show all commits

View File

@ -264,17 +264,15 @@ public class DictionaryManagementService {
// check for the existence of dossier type and create in case it does not exist
if (isDossierTypeId(typeId)) {
try {
var typeResult = dictionaryPersistenceService.getType(typeId);
dictionaryPersistenceService.getType(typeId);
} catch (NotFoundException e) {
// type not found, it should be created based on the info from the dossier template type and if flag dossierDictionaryOnly is also true
var dossierTemplateType = dictionaryPersistenceService.getType(getDosssierTemplateTypeIdFromTypeId(typeId));
if (dossierTemplateType.isDossierDictionaryOnly()) {
Type dossierDictionaryType = MagicConverter.convert(dossierTemplateType, Type.class);
dossierDictionaryType.setVersion(0);
dossierDictionaryType.setDossierId(getDossierIdFromTypeId(typeId));
var returnedType = this.addType(dossierDictionaryType);
log.info("Type added: " + returnedType.toString());
}
Type dossierDictionaryType = MagicConverter.convert(dossierTemplateType, Type.class);
dossierDictionaryType.setVersion(0);
dossierDictionaryType.setDossierId(getDossierIdFromTypeId(typeId));
var returnedType = this.addType(dossierDictionaryType);
log.info("Type added: " + returnedType.toString());
}
}
}

View File

@ -16,7 +16,7 @@ public class TypeIdUtils {
public static boolean isDossierTypeId(String typeId) {
long count = typeId.chars().filter(ch -> ch == ':').count();
return (count == 2);
return count == 2;
}