| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 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 | |
|
| 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 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
public final Constants getConstants() { |
| 70 | 0 | return this.constants; |
| 71 | |
} |
| 72 | |
|
| 73 | |
|
| 74 | |
|
| 75 | |
|
| 76 | |
|
| 77 | |
|
| 78 | |
public final void setConstants(final Constants argConstants) { |
| 79 | 0 | this.constants = argConstants; |
| 80 | 0 | } |
| 81 | |
} |