1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.actionlist.web; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.Collection; |
20 | |
import java.util.Collections; |
21 | |
import java.util.Comparator; |
22 | |
import java.util.List; |
23 | |
|
24 | |
import org.apache.commons.collections.comparators.ComparableComparator; |
25 | |
import org.kuali.rice.kew.actionrequest.Recipient; |
26 | |
import org.kuali.rice.kew.util.WebFriendlyRecipient; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
final class ActionListUtil { |
35 | |
|
36 | 0 | private ActionListUtil() { |
37 | 0 | throw new UnsupportedOperationException("do not call"); |
38 | |
} |
39 | |
|
40 | |
static List<WebFriendlyRecipient> getWebFriendlyRecipients(Collection<Recipient> recipients) { |
41 | 0 | Collection<WebFriendlyRecipient> newRecipients = new ArrayList<WebFriendlyRecipient>(recipients.size()); |
42 | 0 | for (Recipient recipient : recipients) { |
43 | 0 | newRecipients.add(new WebFriendlyRecipient(recipient)); |
44 | |
} |
45 | 0 | List<WebFriendlyRecipient> recipientList = new ArrayList<WebFriendlyRecipient>(newRecipients); |
46 | 0 | Collections.sort(recipientList, new Comparator<WebFriendlyRecipient>() { |
47 | 0 | Comparator<String> comp = new ComparableComparator(); |
48 | |
|
49 | |
@Override |
50 | |
public int compare(WebFriendlyRecipient o1, WebFriendlyRecipient o2) { |
51 | 0 | return comp.compare(o1.getDisplayName().trim().toLowerCase(), o2.getDisplayName().trim().toLowerCase()); |
52 | |
} |
53 | |
}); |
54 | 0 | return recipientList; |
55 | |
} |
56 | |
} |