Coverage Report - org.kuali.student.lum.kim.role.type.HierarchyNodeTestRoleTypeServiceBase
 
Classes in this File Line Coverage Branch Coverage Complexity
HierarchyNodeTestRoleTypeServiceBase
0%
0/16
0%
0/2
1.5
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 package org.kuali.student.lum.kim.role.type;
 16  
 
 17  
 import org.apache.commons.lang.StringUtils;
 18  
 import org.kuali.rice.kim.api.KimConstants;
 19  
 //import org.kuali.rice.kim.api.role.Role;
 20  
 import org.kuali.rice.kim.api.role.RoleMembership;
 21  
 import org.kuali.rice.kns.kim.role.DerivedRoleTypeServiceBase;
 22  
 
 23  
 import java.util.ArrayList;
 24  
 import java.util.List;
 25  
 import java.util.Map;
 26  
 
 27  
 /**
 28  
  * Dummy class to test Hierarchy Node Test
 29  
  * 
 30  
  * @author delyea
 31  
  *
 32  
  */
 33  0
 public class HierarchyNodeTestRoleTypeServiceBase extends DerivedRoleTypeServiceBase {
 34  
 
 35  
     /* (non-Javadoc)
 36  
      * @see org.kuali.rice.kns.kim.role.DerivedRoleTypeServiceBase#getRoleMembersFromDerivedRole(java.lang.String, java.lang.String, org.kuali.rice.kim.bo.types.dto.Map<String,String>)
 37  
      */
 38  
     @Override
 39  
     public List<RoleMembership> getRoleMembersFromDerivedRole(String namespaceCode, String roleName, Map<String, String> qualification) {
 40  0
         List<RoleMembership> roleMembers = new ArrayList<RoleMembership>();
 41  0
         roleMembers.add(RoleMembership.Builder.create(null, null, "eric", KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE, null).build());
 42  0
         roleMembers.add(RoleMembership.Builder.create(null, null, "fran", KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE, null).build());
 43  0
         roleMembers.add(RoleMembership.Builder.create(null, null, "user1", KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE, null).build());
 44  0
         roleMembers.add(RoleMembership.Builder.create(null, null, "user4", KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE, null).build());
 45  0
         return roleMembers;
 46  
     }
 47  
 
 48  
     /* (non-Javadoc)
 49  
      * @see org.kuali.rice.kim.service.support.impl.KimRoleTypeServiceBase#sortRoleMembers(java.util.List)
 50  
      */
 51  
   //  @Override
 52  
     public List<RoleMembership> sortRoleMembers(List<RoleMembership> roleMembers) {
 53  0
         List<RoleMembership> sortedRoleMembers = new ArrayList<RoleMembership>();
 54  0
         int group = 0; // counter for the group number to add to the roleSortingCode
 55  0
         for (RoleMembership roleMembership : roleMembers) {
 56  0
             RoleMembership.Builder bldr = RoleMembership.Builder.create(roleMembership);
 57  0
             bldr.setRoleSortingCode(StringUtils.leftPad(Integer.toString(group), 3, '0'));
 58  0
             sortedRoleMembers.add(bldr.build());
 59  0
             group++;
 60  0
         }
 61  0
         return sortedRoleMembers;
 62  
     }
 63  
 }