1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.salarygroup.validation;
17
18
19 import org.apache.commons.lang.StringUtils;
20 import org.kuali.kpme.core.bo.validation.HrKeyedSetBusinessObjectValidation;
21 import org.kuali.kpme.core.salarygroup.SalaryGroupBo;
22 import org.kuali.kpme.core.salarygroup.SalaryGroupKeyBo;
23 import org.kuali.kpme.core.util.ValidationUtils;
24 import org.kuali.rice.krad.maintenance.MaintenanceDocument;
25 import org.kuali.rice.krad.rules.MaintenanceDocumentRuleBase;
26
27 public class SalaryGroupValidation extends HrKeyedSetBusinessObjectValidation<SalaryGroupBo, SalaryGroupKeyBo>{
28 @Override
29 protected boolean processCustomRouteDocumentBusinessRules(MaintenanceDocument document) {
30 boolean valid = false;
31 LOG.debug("entering custom validation for Salary Group");
32 SalaryGroupBo sg = (SalaryGroupBo) this.getNewDataObject();
33
34 if (sg != null) {
35 valid = true;
36
37
38 valid &= this.validateLeavePlan(sg);
39 }
40 return valid;
41 }
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 private boolean validateLeavePlan(SalaryGroupBo sg) {
66 if (StringUtils.isNotEmpty(sg.getLeavePlan())
67 && !ValidationUtils.validateLeavePlan(sg.getLeavePlan(), sg.getEffectiveLocalDate())) {
68 this.putFieldError("dataObject.leavePlan", "error.existence", "Leave Plan '"
69 + sg.getLeavePlan() + "'");
70 return false;
71 } else {
72 return true;
73 }
74 }
75
76
77 }