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.email.EntityEmail;
23 import org.kuali.rice.kim.util.Constants;
24
25
26
27
28
29 public class EntityEmailMapper extends AbstractContextMapper {
30 private Constants constants;
31
32 public EntityEmail.Builder mapFromContext(DirContextOperations context) {
33 return (EntityEmail.Builder) doMapFromContext(context);
34 }
35
36 public Object doMapFromContext(DirContextOperations context) {
37 return doMapFromContext(context, true);
38 }
39
40 public Object doMapFromContext(DirContextOperations context, boolean isdefault) {
41 final EntityEmail.Builder retval = EntityEmail.Builder.create();
42 final String emailAddress = context.getStringAttribute(getConstants().getEmployeeMailLdapProperty());
43 retval.setEmailAddress(emailAddress);
44 retval.setEmailType(CodedAttribute.Builder.create("WORK"));
45 retval.setDefaultValue(isdefault);
46 retval.setActive(true);
47 return retval;
48 }
49
50
51
52
53
54
55 public final Constants getConstants() {
56 return this.constants;
57 }
58
59
60
61
62
63
64 public final void setConstants(final Constants argConstants) {
65 this.constants = argConstants;
66 }
67 }