RED-4078: Make sure that the dossier template can only be created with a proper name

This commit is contained in:
aoezyetimoglu 2022-06-15 12:27:31 +02:00
parent e340e77b87
commit fe58e92b8f

View File

@ -8,6 +8,7 @@ import java.util.UUID;
import javax.transaction.Transactional;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -53,6 +54,9 @@ public class DossierTemplatePersistenceService {
throw new NotFoundException(String.format(DOSSIER_TEMPLATE_NOT_FOUND_MESSAGE, createOrUpdateDossierRequest.getDossierTemplateId()));
}
} else {
if(StringUtils.isEmpty(createOrUpdateDossierRequest.getName())) {
throw new ConflictException("DossierTemplate name must be set");
}
validateDossierTemplateNameIsUnique(createOrUpdateDossierRequest.getName());
DossierTemplateEntity dossierTemplate = new DossierTemplateEntity();
dossierTemplate.setId(UUID.randomUUID().toString());