1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.overtime.daily.rule.service;
17
18 import java.util.Map;
19
20 import org.apache.commons.lang.StringUtils;
21 import org.kuali.hr.time.HrBusinessObject;
22 import org.kuali.hr.time.overtime.daily.rule.DailyOvertimeRule;
23 import org.kuali.hr.time.service.base.TkServiceLocator;
24 import org.kuali.hr.time.util.HrBusinessObjectMaintainableImpl;
25 import org.kuali.rice.kns.document.MaintenanceDocument;
26 import org.kuali.rice.krad.util.GlobalVariables;
27
28
29 public class DailyOvertimeRuleMaintainableImpl extends HrBusinessObjectMaintainableImpl {
30
31
32
33
34 private static final long serialVersionUID = 1L;
35
36 @Override
37 public void processAfterPost(MaintenanceDocument document,
38 Map<String, String[]> parameters) {
39 DailyOvertimeRule dailyOvertimeRule = (DailyOvertimeRule) document
40 .getDocumentBusinessObject();
41 dailyOvertimeRule.setUserPrincipalId(GlobalVariables.getUserSession()
42 .getPrincipalId());
43 super.processAfterPost(document, parameters);
44 }
45
46 @Override
47 public void processAfterEdit(MaintenanceDocument document,
48 Map<String, String[]> parameters) {
49 DailyOvertimeRule dailyOvertimeRule = (DailyOvertimeRule) document
50 .getDocumentBusinessObject();
51 dailyOvertimeRule.setUserPrincipalId(GlobalVariables.getUserSession()
52 .getPrincipalId());
53 super.processAfterEdit(document, parameters);
54 }
55
56 @SuppressWarnings("rawtypes")
57 @Override
58 public Map populateBusinessObject(Map<String, String> fieldValues,
59 MaintenanceDocument maintenanceDocument, String methodToCall) {
60 if(fieldValues.containsKey("workArea") && StringUtils.equals(fieldValues.get("workArea"),"%")){
61 fieldValues.put("workArea", "-1");
62 }
63 return super.populateBusinessObject(fieldValues, maintenanceDocument,
64 methodToCall);
65 }
66
67 @Override
68 public HrBusinessObject getObjectById(String id) {
69 return TkServiceLocator.getDailyOvertimeRuleService().getDailyOvertimeRule(id);
70 }
71
72
73 }