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.core.api.util.type.KualiDecimal;
19 import org.kuali.rice.kim.api.identity.CodedAttribute;
20 import org.kuali.rice.kim.api.identity.employment.EntityEmployment;
21 import org.springframework.ldap.core.DirContextOperations;
22
23
24
25
26
27 public class EntityEmploymentMapper extends BaseMapper<EntityEmployment> {
28
29 @Override
30 EntityEmployment mapDtoFromContext(DirContextOperations context) {
31 EntityEmployment.Builder builder = mapBuilderFromContext(context);
32 return builder != null ? builder.build() : null;
33 }
34
35 EntityEmployment.Builder mapBuilderFromContext(DirContextOperations context) {
36 final String departmentCode = context.getStringAttribute(getConstants().getDepartmentLdapProperty());
37
38 if (departmentCode == null) {
39 return null;
40 }
41
42 final EntityEmployment.Builder employee = EntityEmployment.Builder.create();
43 employee.setId(context.getStringAttribute(getConstants().getEmployeeIdProperty()));
44 employee.setEmployeeStatus(
45 CodedAttribute.Builder.create(context.getStringAttribute(getConstants().getEmployeeStatusProperty())));
46
47 employee.setEmployeeType(CodedAttribute.Builder.create("P"));
48 employee.setBaseSalaryAmount(KualiDecimal.ZERO);
49
50 employee.setActive(true);
51 return employee;
52 }
53
54 }