RED-6912- Entries not sorted correctly in the dossier dictionary - backport to 3.6
- update the sorting to be case-insensitive - update junit tests
This commit is contained in:
parent
b3ed67450f
commit
7b2ccaea84
@ -8,6 +8,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@ -101,11 +102,11 @@ public class DictionaryController implements DictionaryResource {
|
|||||||
var entity = dictionaryPersistenceService.getType(typeId);
|
var entity = dictionaryPersistenceService.getType(typeId);
|
||||||
var target = convert(entity, Type.class);
|
var target = convert(entity, Type.class);
|
||||||
target.setEntries(convert(entryPersistenceService.getEntries(typeId, DictionaryEntryType.ENTRY, fromVersion), DictionaryEntry.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)
|
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)
|
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;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -351,7 +351,7 @@ public class DictionaryTest extends AbstractPersistenceServerServiceTest {
|
|||||||
var createdType = dictionaryClient.addType(type);
|
var createdType = dictionaryClient.addType(type);
|
||||||
|
|
||||||
var word1 = "Luke Skywalker";
|
var word1 = "Luke Skywalker";
|
||||||
var word2 = "Anakin Skywalker";
|
var word2 = "anakin Skywalker";
|
||||||
var word3 = "Yoda";
|
var word3 = "Yoda";
|
||||||
|
|
||||||
// Act & Assert: Add different words; All three should exist
|
// Act & Assert: Add different words; All three should exist
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user