Coverage Report - org.kuali.rice.kim.ldap.EntityNamePrincipalNameMapper
 
Classes in this File Line Coverage Branch Coverage Complexity
EntityNamePrincipalNameMapper
0%
0/12
N/A
1
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.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/ecl2.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.kim.ldap;
 17  
 
 18  
 import org.springframework.ldap.core.ContextMapper;
 19  
 import org.springframework.ldap.core.DirContextOperations;
 20  
 import org.springframework.ldap.core.support.AbstractContextMapper;
 21  
 
 22  
 import org.kuali.rice.kim.api.identity.name.EntityName;
 23  
 import org.kuali.rice.kim.api.identity.principal.EntityNamePrincipalName;
 24  
 import org.kuali.rice.kim.util.Constants;
 25  
 
 26  
 /**
 27  
  * 
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  0
 public class EntityNamePrincipalNameMapper extends AbstractContextMapper {
 31  
     private Constants constants;
 32  
 
 33  
     private ContextMapper defaultNameMapper;
 34  
     
 35  
     public EntityNamePrincipalName mapFromContext(DirContextOperations context) {
 36  0
         return ((EntityNamePrincipalName.Builder) doMapFromContext(context)).build();
 37  
     }
 38  
     
 39  
     public Object doMapFromContext(DirContextOperations context) {
 40  0
         final EntityNamePrincipalName.Builder person = EntityNamePrincipalName.Builder.create();
 41  0
         person.setDefaultName((EntityName.Builder) getDefaultNameMapper().mapFromContext(context));
 42  0
         person.setPrincipalName(context.getStringAttribute(getConstants().getKimLdapNameProperty()));
 43  0
         return person;
 44  
     }
 45  
     
 46  
     /**
 47  
      * Gets the value of constants
 48  
      *
 49  
      * @return the value of constants
 50  
      */
 51  
     public final Constants getConstants() {
 52  0
         return this.constants;
 53  
     }
 54  
 
 55  
     /**
 56  
      * Sets the value of constants
 57  
      *
 58  
      * @param argConstants Value to assign to this.constants
 59  
      */
 60  
     public final void setConstants(final Constants argConstants) {
 61  0
         this.constants = argConstants;
 62  0
     }
 63  
 
 64  
 
 65  
     /**
 66  
      * Gets the value of defaultNameMapper
 67  
      *
 68  
      * @return the value of defaultNameMapper
 69  
      */
 70  
     public final ContextMapper getDefaultNameMapper() {
 71  0
         return this.defaultNameMapper;
 72  
     }
 73  
 
 74  
     /**
 75  
      * Sets the value of defaultNameMapper
 76  
      *
 77  
      * @param argDefaultNameMapper Value to assign to this.defaultNameMapper
 78  
      */
 79  
     public final void setDefaultNameMapper(final ContextMapper argDefaultNameMapper) {
 80  0
         this.defaultNameMapper = argDefaultNameMapper;
 81  0
     }
 82  
 }