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