Pull request #459: RED-3081-As an admin of a dossier template I want to customize the highlighting color of a skipped redaction of an entity
Merge in RED/persistence-service from feature/REd-3081_fix1 to master * commit '9453a8250ae190a650d0f425ac529e42ba4cad8e': RED-3081-As an admin of a dossier template I want to customize the highlighting color of a skipped redaction of an entity
This commit is contained in:
commit
e301d55cc8
@ -19,6 +19,7 @@ import com.iqser.red.service.persistence.service.v1.api.resources.DictionaryReso
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -116,6 +117,13 @@ public class DictionaryController implements DictionaryResource {
|
||||
validateColor(typeValueRequest.getHexColor());
|
||||
validateBoolean(typeValueRequest.isHint(), "isHint");
|
||||
validateBoolean(typeValueRequest.isCaseInsensitive(), "isCaseInsensitive");
|
||||
String skippedHexColor = typeValueRequest.getSkippedHexColor();
|
||||
if (StringUtils.isBlank(skippedHexColor)) { //use the default value
|
||||
skippedHexColor = colorsService.getColors(typeValueRequest.getDossierTemplateId()).getNotRedacted();
|
||||
typeValueRequest.setSkippedHexColor(skippedHexColor);
|
||||
} else {
|
||||
validateColor(skippedHexColor);
|
||||
}
|
||||
// To check whether the type exists
|
||||
Type typeResult = convert(dictionaryPersistenceService.getType(typeId), Type.class);
|
||||
|
||||
@ -169,7 +177,13 @@ public class DictionaryController implements DictionaryResource {
|
||||
}
|
||||
String color = typeRequest.getHexColor();
|
||||
validateColor(color);
|
||||
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);
|
||||
String skippedHexColor = typeRequest.getSkippedHexColor();
|
||||
if (StringUtils.isBlank(skippedHexColor)) { //use the default value
|
||||
skippedHexColor = colorsService.getColors(typeRequest.getDossierTemplateId()).getNotRedacted();
|
||||
} else {
|
||||
validateColor(typeRequest.getSkippedHexColor());
|
||||
}
|
||||
return convert(dictionaryPersistenceService.addType(typeRequest.getType(), typeRequest.getDossierTemplateId(), color, typeRequest.getRecommendationHexColor(), skippedHexColor, typeRequest.getRank(), typeRequest.isHint(), typeRequest.isCaseInsensitive(), typeRequest.isRecommendation(), typeRequest.getDescription(), typeRequest.isAddToDictionaryAction(), typeRequest.getLabel(), typeRequest.getDossierId(), typeRequest.isHasDictionary(), typeRequest.isSystemManaged(), typeRequest.isAutoHideSkipped()), Type.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -58,6 +58,21 @@ public class DictionaryTest extends AbstractPersistenceServerServiceTest {
|
||||
assertThat(loadedType.getFalseRecommendationEntries()).hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkippedColor() {
|
||||
|
||||
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
|
||||
var type = typeProvider.testAndProvideType(dossierTemplate);
|
||||
assertThat(type.getRecommendationHexColor()).isEqualTo("#aaaaaa");
|
||||
assertThat(type.getSkippedHexColor()).isEqualTo("#aaaaaa");
|
||||
|
||||
type.setSkippedHexColor(null);
|
||||
dictionaryClient.updateTypeValue(type.getTypeId(), type);
|
||||
|
||||
var loadedType = dictionaryClient.getDictionaryForType(type.getId(), null);
|
||||
assertThat(loadedType.getSkippedHexColor()).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddEntriesWithStopWord() {
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user