RED-3081-As an admin of a dossier template I want to customize the highlighting color of a skipped redaction of an entity

- add skippedHexColor to type entity
- update of tests
This commit is contained in:
devplant 2022-06-21 10:55:14 +03:00
parent 237667e9c8
commit d537a16d65
10 changed files with 25 additions and 3 deletions

View File

@ -22,6 +22,7 @@ public class Type {
private String label;
private String hexColor;
private String recommendationHexColor;
private String skippedHexColor;
private int rank;
private boolean isHint;
private boolean isCaseInsensitive;

View File

@ -46,6 +46,8 @@ public class TypeEntity {
@Column
private String recommendationHexColor;
@Column
private String skippedHexColor;
@Column
private int rank;
@Column
private boolean isHint;

View File

@ -120,7 +120,7 @@ public class DossierTemplateCloneService {
private void cloneDictionariesWithEntries(String dossierTemplateId, String clonedDossierTemplateId) {
var types = dictionaryPersistenceService.getAllTypesForDossierTemplate(dossierTemplateId, false);
for (TypeEntity t : types) {
var type = dictionaryPersistenceService.addType(t.getType(), clonedDossierTemplateId, t.getHexColor(), t.getRecommendationHexColor(), t.getRank(), t.isHint(), t.isCaseInsensitive(), t.isRecommendation(), t.getDescription(), t.isAddToDictionaryAction(), t.getLabel(), null, t.isHasDictionary(), t.isSystemManaged(), t.isAutoHideSkipped());
var type = dictionaryPersistenceService.addType(t.getType(), clonedDossierTemplateId, t.getHexColor(), t.getRecommendationHexColor(), t.getSkippedHexColor(), t.getRank(), t.isHint(), t.isCaseInsensitive(), t.isRecommendation(), t.getDescription(), t.isAddToDictionaryAction(), t.getLabel(), null, t.isHasDictionary(), t.isSystemManaged(), t.isAutoHideSkipped());
entryPersistenceService.cloneEntries(t.getId(), type.getId());
}
}

View File

@ -33,7 +33,7 @@ public class DictionaryPersistenceService {
private final EntryRepository entryRepository;
public TypeEntity addType(String type, String dossierTemplateId, String hexColor, String recommendationHexColor, int rank, boolean isHint, boolean caseInsensitive,
public TypeEntity addType(String type, String dossierTemplateId, String hexColor, String recommendationHexColor, String skippedHexColor, int rank, boolean isHint, boolean caseInsensitive,
boolean isRecommendation, String description, boolean addToDictionaryAction, String label, String dossierId, boolean hasDictionary,
boolean systemManaged, boolean autoHideSkipped) {
@ -46,6 +46,7 @@ public class DictionaryPersistenceService {
.dossierTemplate(dossierTemplateRepository.getOne(dossierTemplateId))
.hexColor(hexColor)
.recommendationHexColor(recommendationHexColor)
.skippedHexColor(skippedHexColor)
.rank(rank)
.description(description)
.isHint(isHint)
@ -77,6 +78,7 @@ public class DictionaryPersistenceService {
if (type.isSystemManaged()) {
type.setHexColor(typeValueRequest.getHexColor());
type.setRecommendationHexColor(typeValueRequest.getRecommendationHexColor());
type.setSkippedHexColor(typeValueRequest.getSkippedHexColor());
type.setDescription(typeValueRequest.getDescription());
type.setLabel(typeValueRequest.getLabel());
type.setAddToDictionaryAction(typeValueRequest.isAddToDictionaryAction());

View File

@ -169,7 +169,7 @@ public class DictionaryController implements DictionaryResource {
}
String color = typeRequest.getHexColor();
validateColor(color);
return convert(dictionaryPersistenceService.addType(typeRequest.getType(), typeRequest.getDossierTemplateId(), color, typeRequest.getRecommendationHexColor(), typeRequest.getRank(), typeRequest.isHint(), typeRequest.isCaseInsensitive(), typeRequest.isRecommendation(), typeRequest.getDescription(), typeRequest.isAddToDictionaryAction(), typeRequest.getLabel(), typeRequest.getDossierId(), typeRequest.isHasDictionary(), typeRequest.isSystemManaged(), typeRequest.isAutoHideSkipped()), Type.class);
return convert(dictionaryPersistenceService.addType(typeRequest.getType(), typeRequest.getDossierTemplateId(), color, typeRequest.getRecommendationHexColor(), typeRequest.getSkippedHexColor(), typeRequest.getRank(), typeRequest.isHint(), typeRequest.isCaseInsensitive(), typeRequest.isRecommendation(), typeRequest.getDescription(), typeRequest.isAddToDictionaryAction(), typeRequest.getLabel(), typeRequest.getDossierId(), typeRequest.isHasDictionary(), typeRequest.isSystemManaged(), typeRequest.isAutoHideSkipped()), Type.class);
}

View File

@ -0,0 +1,11 @@
databaseChangeLog:
- changeSet:
id: add-skipped-color
author: corinaolariu
changes:
- addColumn:
columns:
- column:
name: skipped_hex_color
type: VARCHAR(255)
tableName: entity

View File

@ -75,3 +75,5 @@ databaseChangeLog:
file: db/changelog/31-add-file-size-column.changelog.yaml
- include:
file: db/changelog/sql/31-watermark-configuration.sql
- include:
file: db/changelog/32-added-skipped-color-type-table.changelog.yaml

View File

@ -25,6 +25,7 @@ public class TypeProvider {
type.setAddToDictionaryAction(true);
type.setHexColor("#dddddd");
type.setRecommendationHexColor("#aaaaaa");
type.setSkippedHexColor("#aaaaaa");
type.setHint(false);
type.setRank(100);
type.setRecommendation(false);

View File

@ -42,6 +42,7 @@ public class DictionaryTest extends AbstractPersistenceServerServiceTest {
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
var type = typeProvider.testAndProvideType(dossierTemplate);
assertThat(type.getRecommendationHexColor()).isEqualTo("#aaaaaa");
assertThat(type.getSkippedHexColor()).isEqualTo("#aaaaaa");
dictionaryClient.addEntries(type.getTypeId(), List.of("word1", "word2"), false, false, DictionaryEntryType.ENTRY);
dictionaryClient.addEntries(type.getTypeId(), List.of("false_positive1", "false_positive"), false, false, DictionaryEntryType.FALSE_POSITIVE);

View File

@ -124,6 +124,7 @@ public class DossierTemplateTest extends AbstractPersistenceServerServiceTest {
.dossierTemplateId(dossierTemplate.getId())
.hexColor("#ddddd")
.recommendationHexColor("#cccccc")
.skippedHexColor("#cccccc")
.rank(999)
.isHint(false)
.isRecommendation(false)
@ -144,6 +145,7 @@ public class DossierTemplateTest extends AbstractPersistenceServerServiceTest {
.dossierTemplateId(dossierTemplate.getId())
.hexColor("#12345")
.recommendationHexColor("#6789a")
.skippedHexColor("#6789a")
.rank(1002)
.isHint(false)
.isRecommendation(false)