1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.calendar.validation;
17
18 import java.sql.Time;
19
20 import org.apache.commons.lang.StringUtils;
21 import org.kuali.kpme.core.calendar.Calendar;
22 import org.kuali.rice.kns.document.MaintenanceDocument;
23 import org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase;
24
25 public class CalendarRule extends MaintenanceDocumentRuleBase {
26 @Override
27 protected boolean processCustomRouteDocumentBusinessRules(
28 MaintenanceDocument document) {
29 boolean valid = true;
30
31 Calendar calendar = (Calendar) this.getNewBo();
32 if (StringUtils.equals(calendar.getCalendarTypes(), "Pay")){
33 valid = validateFLSABeginDay(calendar.getFlsaBeginDay());
34 valid = validateFLSABeginTime(calendar.getFlsaBeginTime());
35 }
36 return valid;
37 }
38
39 boolean validateFLSABeginDay(String flsaBeginDay) {
40 boolean valid = true;
41 if (StringUtils.isEmpty(flsaBeginDay)) {
42 this.putFieldError("flsaBeginDay", "error.required",
43 "FLSA Begin Day");
44 valid = false;
45 }
46 return valid;
47 }
48 boolean validateFLSABeginTime(Time flsaBeginTime) {
49 boolean valid = true;
50 if (flsaBeginTime == null) {
51 this.putFieldError("flsaBeginTime", "error.required",
52 "FLSA Begin Time");
53 valid = false;
54 }
55 return valid;
56 }
57
58 }