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.kuali.rice.kim.api.identity.name.EntityName;
19 import org.kuali.rice.kim.api.identity.principal.EntityNamePrincipalName;
20 import org.springframework.ldap.core.ContextMapper;
21 import org.springframework.ldap.core.DirContextOperations;
22
23
24
25
26
27 public class EntityNamePrincipalNameMapper extends BaseMapper<EntityNamePrincipalName> {
28
29 private ContextMapper defaultNameMapper;
30
31 @Override
32 EntityNamePrincipalName mapDtoFromContext(DirContextOperations context) {
33 EntityNamePrincipalName.Builder builder = mapBuilderFromContext(context);
34 return builder != null ? builder.build() : null;
35 }
36
37 EntityNamePrincipalName.Builder mapBuilderFromContext(DirContextOperations context) {
38 final EntityNamePrincipalName.Builder person = EntityNamePrincipalName.Builder.create();
39 person.setDefaultName((EntityName.Builder) getDefaultNameMapper().mapFromContext(context));
40 person.setPrincipalName(context.getStringAttribute(getConstants().getKimLdapNameProperty()));
41 return person;
42 }
43
44
45
46
47
48
49 public final ContextMapper getDefaultNameMapper() {
50 return this.defaultNameMapper;
51 }
52
53
54
55
56
57
58 public final void setDefaultNameMapper(final ContextMapper argDefaultNameMapper) {
59 this.defaultNameMapper = argDefaultNameMapper;
60 }
61 }