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 private ActionListUtil() {
37 throw new UnsupportedOperationException("do not call");
38 }
39
40 static List<WebFriendlyRecipient> getWebFriendlyRecipients(Collection<Recipient> recipients) {
41 Collection<WebFriendlyRecipient> newRecipients = new ArrayList<WebFriendlyRecipient>(recipients.size());
42 for (Recipient recipient : recipients) {
43 newRecipients.add(new WebFriendlyRecipient(recipient));
44 }
45 List<WebFriendlyRecipient> recipientList = new ArrayList<WebFriendlyRecipient>(newRecipients);
46 Collections.sort(recipientList, new Comparator<WebFriendlyRecipient>() {
47 Comparator<String> comp = new ComparableComparator();
48
49 @Override
50 public int compare(WebFriendlyRecipient o1, WebFriendlyRecipient o2) {
51 return comp.compare(o1.getDisplayName().trim().toLowerCase(), o2.getDisplayName().trim().toLowerCase());
52 }
53 });
54 return recipientList;
55 }
56 }