Coverage Report - org.kuali.rice.kim.ldap.EntityEmailMapper
 
Classes in this File Line Coverage Branch Coverage Complexity
EntityEmailMapper
0%
0/13
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.DirContextOperations;
 19  
 import org.springframework.ldap.core.support.AbstractContextMapper;
 20  
 
 21  
 import org.kuali.rice.kim.api.identity.CodedAttribute;
 22  
 import org.kuali.rice.kim.api.identity.email.EntityEmail;
 23  
 import org.kuali.rice.kim.util.Constants;
 24  
 
 25  
 /**
 26  
  * 
 27  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 28  
  */
 29  0
 public class EntityEmailMapper extends AbstractContextMapper {
 30  
     private Constants constants;
 31  
     
 32  
     public EntityEmail.Builder mapFromContext(DirContextOperations context) {
 33  0
         return (EntityEmail.Builder) doMapFromContext(context);
 34  
     }
 35  
 
 36  
     public Object doMapFromContext(DirContextOperations context) {        
 37  0
         return doMapFromContext(context, true);
 38  
     }
 39  
 
 40  
     public Object doMapFromContext(DirContextOperations context, boolean isdefault) {        
 41  0
         final EntityEmail.Builder retval = EntityEmail.Builder.create();
 42  0
         final String emailAddress = context.getStringAttribute(getConstants().getEmployeeMailLdapProperty());
 43  0
         retval.setEmailAddress(emailAddress);
 44  0
         retval.setEmailType(CodedAttribute.Builder.create("WORK"));
 45  0
         retval.setDefaultValue(isdefault);
 46  0
         retval.setActive(true);
 47  0
         return retval;
 48  
     }
 49  
     
 50  
     /**
 51  
      * Gets the value of constants
 52  
      *
 53  
      * @return the value of constants
 54  
      */
 55  
     public final Constants getConstants() {
 56  0
         return this.constants;
 57  
     }
 58  
 
 59  
     /**
 60  
      * Sets the value of constants
 61  
      *
 62  
      * @param argConstants Value to assign to this.constants
 63  
      */
 64  
     public final void setConstants(final Constants argConstants) {
 65  0
         this.constants = argConstants;
 66  0
     }
 67  
 }