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