View Javadoc
1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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   * @author Kuali Rice Team (rice.collab@kuali.org)
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          //employee.setEmployeeTypeCode(context.getStringAttribute(getConstants().getEmployeeTypeProperty()));
47          employee.setEmployeeType(CodedAttribute.Builder.create("P"));
48          employee.setBaseSalaryAmount(KualiDecimal.ZERO);
49          
50          employee.setActive(true);
51          return employee;
52      }
53      
54  }