RED-5624: Refactoring of justifications
added technicalname field to entity
This commit is contained in:
parent
55c6b7419d
commit
8d340057a4
@ -20,5 +20,7 @@ public class LegalBasisEntity {
|
||||
private String description;
|
||||
@Column(length = 4000)
|
||||
private String reason;
|
||||
@Column(length = 4000)
|
||||
private String technicalName;
|
||||
|
||||
}
|
||||
|
||||
@ -82,12 +82,14 @@ public class LegalBasisMappingPersistenceService {
|
||||
.findAny().ifPresentOrElse(existingBasis -> {
|
||||
existingBasis.setReason(legalBasis.getReason());
|
||||
existingBasis.setDescription(legalBasis.getDescription());
|
||||
existingBasis.setTechnicalName(legalBasis.getTechnicalName());
|
||||
},
|
||||
() -> mapping.getLegalBasis()
|
||||
.add(LegalBasisEntity.builder()
|
||||
.name(legalBasis.getName())
|
||||
.description(legalBasis.getDescription())
|
||||
.reason(legalBasis.getReason())
|
||||
.technicalName(legalBasis.getTechnicalName())
|
||||
.build()));
|
||||
|
||||
mapping.setVersion(mapping.getVersion() + 1);
|
||||
@ -109,6 +111,10 @@ public class LegalBasisMappingPersistenceService {
|
||||
if (legalBasis.getReason().length() > MAX_LEGAL_BASIS_LENGTH) {
|
||||
throw new BadRequestException(String.format("The legal basis is too long (%s), max length %s", legalBasis.getReason().length(), MAX_LEGAL_BASIS_LENGTH));
|
||||
}
|
||||
|
||||
if(legalBasis.getTechnicalName().length() > MAX_LEGAL_BASIS_LENGTH) {
|
||||
throw new BadRequestException(String.format("The legal basis is too long (%s), max length %s", legalBasis.getTechnicalName().length(), MAX_LEGAL_BASIS_LENGTH));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -41,8 +41,8 @@ public class LegalBasisTest extends AbstractPersistenceServerServiceTest {
|
||||
}
|
||||
|
||||
var mappings = new ArrayList<LegalBasis>();
|
||||
mappings.add(LegalBasis.builder().name("test 1").description("test 1").reason("test 1").build());
|
||||
mappings.add(LegalBasis.builder().name("test 2").description("test 2").reason("test 2").build());
|
||||
mappings.add(LegalBasis.builder().name("test 1").description("test 1").reason("test 1").technicalName("test 1").build());
|
||||
mappings.add(LegalBasis.builder().name("test 2").description("test 2").reason("test 2").technicalName("test 2").build());
|
||||
legalBasisClient.setLegalBasisMapping(mappings, dossierTemplate.getId());
|
||||
|
||||
var mapping = legalBasisClient.getLegalBasisMapping(dossierTemplate.getId());
|
||||
@ -51,7 +51,7 @@ public class LegalBasisTest extends AbstractPersistenceServerServiceTest {
|
||||
.map(LegalBasis::getName)
|
||||
.collect(Collectors.toList())).containsExactlyInAnyOrder("test 1", "test 2");
|
||||
|
||||
var legalBasis = LegalBasis.builder().name("test 3").description("test 3").reason("test 3").build();
|
||||
var legalBasis = LegalBasis.builder().name("test 3").description("test 3").reason("test 3").technicalName("test 3").build();
|
||||
legalBasisClient.addOrUpdateLegalBasis(dossierTemplate.getId(), legalBasis);
|
||||
|
||||
mapping = legalBasisClient.getLegalBasisMapping(dossierTemplate.getId());
|
||||
@ -60,7 +60,7 @@ public class LegalBasisTest extends AbstractPersistenceServerServiceTest {
|
||||
.map(LegalBasis::getName)
|
||||
.collect(Collectors.toList())).containsExactlyInAnyOrder("test 1", "test 2", "test 3");
|
||||
|
||||
legalBasis = LegalBasis.builder().name("test 3").reason("test 3").description("test 3 - updated").build();
|
||||
legalBasis = LegalBasis.builder().name("test 3").reason("test 3").description("test 3 - updated").technicalName("test 3").build();
|
||||
legalBasisClient.addOrUpdateLegalBasis(dossierTemplate.getId(), legalBasis);
|
||||
|
||||
mapping = legalBasisClient.getLegalBasisMapping(dossierTemplate.getId());
|
||||
|
||||
@ -14,5 +14,6 @@ public class LegalBasis {
|
||||
private String name;
|
||||
private String description;
|
||||
private String reason;
|
||||
private String technicalName;
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user