1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.dept.lunch.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.dept.lunch.DeptLunchRule;
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 public class DeptLunchRuleMaintainableImpl extends HrBusinessObjectMaintainableImpl {
29
30
31
32
33 private static final long serialVersionUID = 1L;
34
35 @Override
36 public void processAfterPost(MaintenanceDocument document,
37 Map<String, String[]> parameters) {
38 DeptLunchRule deptLunchRule = (DeptLunchRule) document
39 .getDocumentBusinessObject();
40 deptLunchRule.setUserPrincipalId(GlobalVariables.getUserSession()
41 .getPrincipalId());
42 super.processAfterPost(document, parameters);
43 }
44
45 @Override
46 public void processAfterEdit(MaintenanceDocument document,
47 Map<String, String[]> parameters) {
48 DeptLunchRule deptLunchRule = (DeptLunchRule) document
49 .getDocumentBusinessObject();
50 deptLunchRule.setUserPrincipalId(GlobalVariables.getUserSession()
51 .getPrincipalId());
52 super.processAfterEdit(document, parameters);
53 }
54
55 @Override
56 public Map populateBusinessObject(Map<String, String> fieldValues,
57 MaintenanceDocument maintenanceDocument, String methodToCall) {
58 if (fieldValues.containsKey("workArea")
59 && StringUtils.equals(fieldValues.get("workArea"), "%")) {
60 fieldValues.put("workArea", "-1");
61 }
62 if (fieldValues.containsKey("jobNumber")
63 && StringUtils.equals(fieldValues.get("jobNumber"), "%")) {
64 fieldValues.put("jobNumber", "-1");
65 }
66 return super.populateBusinessObject(fieldValues, maintenanceDocument,
67 methodToCall);
68 }
69
70 @Override
71 public HrBusinessObject getObjectById(String id) {
72 return TkServiceLocator.getDepartmentLunchRuleService().getDepartmentLunchRule(id);
73 }
74 }