Coverage Report - org.kuali.rice.kim.ldap.EntityAddressMapper
 
Classes in this File Line Coverage Branch Coverage Complexity
EntityAddressMapper
0%
0/22
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.address.EntityAddress;
 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 EntityAddressMapper extends AbstractContextMapper {
 30  
     private Constants constants;
 31  
 
 32  
     public EntityAddress.Builder mapFromContext(DirContextOperations context, boolean isdefault) {
 33  0
         return (EntityAddress.Builder) doMapFromContext(context, isdefault);
 34  
     }
 35  
 
 36  
     public EntityAddress.Builder mapFromContext(DirContextOperations context) {
 37  0
         return mapFromContext(context, false);
 38  
     }
 39  
 
 40  
     public Object doMapFromContext(DirContextOperations context) {
 41  0
         return doMapFromContext(context, false);
 42  
     }
 43  
 
 44  
     protected Object doMapFromContext(DirContextOperations context, boolean isdefault) {        
 45  0
         final EntityAddress.Builder builder = EntityAddress.Builder.create();
 46  0
         final String line1              = context.getStringAttribute("employeePrimaryDeptName");
 47  0
         final String line2              = context.getStringAttribute("employeePoBox");
 48  0
         final String city               = context.getStringAttribute("employeeCity");
 49  0
         final String stateProvinceCode  = context.getStringAttribute("employeeState");
 50  0
         final String postalCode         = context.getStringAttribute("employeeZip");
 51  
         
 52  0
         builder.setAddressType(CodedAttribute.Builder.create("WORK"));
 53  0
         builder.setLine1(line1);
 54  0
         builder.setLine2(line2);
 55  0
         builder.setCity(city);
 56  0
         builder.setStateProvinceCode(stateProvinceCode);
 57  0
         builder.setPostalCode(postalCode);
 58  0
         builder.setDefaultValue(isdefault);
 59  0
         builder.setActive(true);
 60  0
         return builder;
 61  
     }
 62  
     
 63  
     
 64  
     /**
 65  
      * Gets the value of constants
 66  
      *
 67  
      * @return the value of constants
 68  
      */
 69  
     public final Constants getConstants() {
 70  0
         return this.constants;
 71  
     }
 72  
 
 73  
     /**
 74  
      * Sets the value of constants
 75  
      *
 76  
      * @param argConstants Value to assign to this.constants
 77  
      */
 78  
     public final void setConstants(final Constants argConstants) {
 79  0
         this.constants = argConstants;
 80  0
     }
 81  
 }