RED-6485 - Dossier-only entity setting in the dossier template, RED-6743 - Create dossier dictionaries on-the-fly

- remove check for dossier dictionary only
- fix PMD violations
This commit is contained in:
Corina Olariu 2023-06-13 13:05:00 +03:00
parent e160f5e556
commit 889e63e7c7
2 changed files with 7 additions and 9 deletions

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;
}