From 13230d5dce7a00d9bb1e24176100ee0c2697eeb5 Mon Sep 17 00:00:00 2001 From: joaquinmarques Date: Fri, 23 Feb 2018 15:26:19 +0100 Subject: [PATCH] SAK-33890 Update EnrollmentDecorator.java (#5332) --- .../tool/section/decorator/EnrollmentDecorator.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/EnrollmentDecorator.java b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/EnrollmentDecorator.java index e97ccf027f63..ed98aadf301d 100644 --- a/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/EnrollmentDecorator.java +++ b/sections/sections-app-util/src/java/org/sakaiproject/tool/section/decorator/EnrollmentDecorator.java @@ -23,9 +23,10 @@ import java.io.Serializable; import java.util.Comparator; import java.util.Map; +import java.text.Collator; import lombok.extern.slf4j.Slf4j; - +import org.apache.commons.lang.builder.CompareToBuilder; import org.sakaiproject.section.api.coursemanagement.CourseSection; import org.sakaiproject.section.api.coursemanagement.EnrollmentRecord; import org.sakaiproject.section.api.coursemanagement.User; @@ -52,8 +53,15 @@ public EnrollmentDecorator(EnrollmentRecord enrollment, Map categoryToSectionMap public static final Comparator getNameComparator(final boolean sortAscending) { return new Comparator() { + private final Collator collator = Collator.getInstance(); + private int compareUsers(final User u1, final User u2) { + this.collator.setStrength(Collator.PRIMARY); + return new CompareToBuilder() + .append(u1.getSortName(), u2.getSortName(), this.collator) + .toComparison(); + } public int compare(EnrollmentDecorator enr1, EnrollmentDecorator enr2) { - int comparison = enr1.getUser().getSortName().compareTo(enr2.getUser().getSortName()); + int comparison = compareUsers(enr1.getUser(), enr2.getUser()); return sortAscending ? comparison : (-1 * comparison); } };