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 | 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 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
public final Constants getConstants() { |
56 | 0 | return this.constants; |
57 | |
} |
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
public final void setConstants(final Constants argConstants) { |
65 | 0 | this.constants = argConstants; |
66 | 0 | } |
67 | |
} |