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.employment.EntityEmployment;
23 import org.kuali.rice.kim.util.Constants;
24
25 import org.kuali.rice.core.api.util.type.KualiDecimal;
26
27
28
29
30
31 public class EntityEmploymentMapper extends AbstractContextMapper {
32 private Constants constants;
33
34
35 public EntityEmployment.Builder mapFromContext(DirContextOperations context) {
36 return (EntityEmployment.Builder) doMapFromContext(context);
37 }
38
39 public Object doMapFromContext(DirContextOperations context) {
40 final String departmentCode = context.getStringAttribute(getConstants().getDepartmentLdapProperty());
41
42 if (departmentCode == null) {
43 return null;
44 }
45
46 final EntityEmployment.Builder employee = EntityEmployment.Builder.create();
47 employee.setId(context.getStringAttribute(getConstants().getEmployeeIdProperty()));
48 employee.setEmployeeStatus(
49 CodedAttribute.Builder.create(context.getStringAttribute(getConstants().getEmployeeStatusProperty())));
50
51 employee.setEmployeeType(CodedAttribute.Builder.create("P"));
52 employee.setBaseSalaryAmount(KualiDecimal.ZERO);
53
54 employee.setActive(true);
55 return employee;
56 }
57
58
59
60
61
62
63 public final Constants getConstants() {
64 return this.constants;
65 }
66
67
68
69
70
71
72 public final void setConstants(final Constants argConstants) {
73 this.constants = argConstants;
74 }
75 }