Coverage Report - org.kuali.rice.kew.actionlist.web.ActionListUtil
 
Classes in this File Line Coverage Branch Coverage Complexity
ActionListUtil
0%
0/8
0%
0/2
1.667
ActionListUtil$1
0%
0/3
N/A
1.667
 
 1  
 /*
 2  
  * Copyright 2007 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl1.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 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  
  * Internal Utility class for Action Lists.
 30  
  * 
 31  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 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  
 }