RED-6912- Entries not sorted correctly in the dossier dictionary - backport to 3.6 #29

Merged
corina.olariu.ext1 merged 1 commits from RED-6912-ignorecase3.6 into release/1.363.x 2023-06-26 11:18:34 +02:00
2 changed files with 5 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import java.util.stream.Collectors;
import javax.transaction.Transactional;
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;
@ -101,11 +102,11 @@ public class DictionaryController implements DictionaryResource {
var entity = dictionaryPersistenceService.getType(typeId);
var target = convert(entity, Type.class);
target.setEntries(convert(entryPersistenceService.getEntries(typeId, DictionaryEntryType.ENTRY, fromVersion), DictionaryEntry.class)
.stream().sorted(Comparator.comparing(DictionaryEntry::getValue)).collect(Collectors.toList()));
.stream().sorted(Comparator.comparing(input -> StringUtils.lowerCase(input.getValue()))).collect(Collectors.toList()));
target.setFalsePositiveEntries(convert(entryPersistenceService.getEntries(typeId, DictionaryEntryType.FALSE_POSITIVE, fromVersion), DictionaryEntry.class)
.stream().sorted(Comparator.comparing(DictionaryEntry::getValue)).collect(Collectors.toList()));
.stream().sorted(Comparator.comparing(input -> StringUtils.lowerCase(input.getValue()))).collect(Collectors.toList()));
target.setFalseRecommendationEntries(convert(entryPersistenceService.getEntries(typeId, DictionaryEntryType.FALSE_RECOMMENDATION, fromVersion), DictionaryEntry.class)
.stream().sorted(Comparator.comparing(DictionaryEntry::getValue)).collect(Collectors.toList()));
.stream().sorted(Comparator.comparing(input -> StringUtils.lowerCase(input.getValue()))).collect(Collectors.toList()));
return target;
}

View File

@ -351,7 +351,7 @@ public class DictionaryTest extends AbstractPersistenceServerServiceTest {
var createdType = dictionaryClient.addType(type);
var word1 = "Luke Skywalker";
var word2 = "Anakin Skywalker";
var word2 = "anakin Skywalker";
var word3 = "Yoda";
// Act & Assert: Add different words; All three should exist