1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.earncodesec.service;
17
18 import org.kuali.hr.earncodesec.EarnCodeSecurity;
19 import org.kuali.hr.time.HrBusinessObject;
20 import org.kuali.hr.time.service.base.TkServiceLocator;
21 import org.kuali.hr.time.util.HrBusinessObjectMaintainableImpl;
22 import org.kuali.hr.time.util.ValidationUtils;
23 import org.kuali.rice.kns.document.MaintenanceDocument;
24 import org.kuali.rice.krad.util.GlobalVariables;
25 import org.kuali.rice.krad.util.KRADConstants;
26
27 import java.util.Map;
28
29 public class EarnCodeSecurityMaintainableImpl extends HrBusinessObjectMaintainableImpl {
30
31
32
33 private static final long serialVersionUID = 1L;
34
35
36 @Override
37 public void processAfterEdit( MaintenanceDocument document, Map<String,String[]> parameters ) {
38 EarnCodeSecurity departmentEarnCode = (EarnCodeSecurity) this.getBusinessObject();
39 int count = TkServiceLocator.getEarnCodeSecurityService().getNewerEarnCodeSecurityCount(departmentEarnCode.getEarnCode(), departmentEarnCode.getEffectiveDate());
40 if(count > 0) {
41 GlobalVariables.getMessageMap().putWarningWithoutFullErrorPath(
42 KRADConstants.MAINTENANCE_NEW_MAINTAINABLE + "effectiveDate",
43 "deptEarncode.effectiveDate.newer.exists");
44 }
45
46 if(ValidationUtils.duplicateDeptEarnCodeExists(departmentEarnCode)) {
47 GlobalVariables.getMessageMap().putWarningWithoutFullErrorPath(
48 KRADConstants.MAINTENANCE_NEW_MAINTAINABLE + "dept",
49 "deptEarncode.duplicate.exists");
50 }
51 }
52
53 @Override
54 public HrBusinessObject getObjectById(String id) {
55 return TkServiceLocator.getEarnCodeSecurityService().getEarnCodeSecurity(id);
56 }
57 }