View Javadoc

1   /**
2    * Copyright 2004-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.hr.time.calendar.validation;
17  
18  import java.sql.Time;
19  
20  import org.apache.commons.lang.StringUtils;
21  import org.kuali.hr.time.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  		valid = validateFLSABeginDay(calendar.getFlsaBeginDay());
33  		valid = validateFLSABeginTime(calendar.getFlsaBeginTime());
34  		return valid;
35  	}
36  
37  	boolean validateFLSABeginDay(String flsaBeginDay) {
38  		boolean valid = true;
39  		if (StringUtils.isEmpty(flsaBeginDay)) {
40  			this.putFieldError("flsaBeginDay", "error.required",
41  					"FLSA Begin Day");
42  			valid = false;
43  		}
44  		return valid;
45  	}
46  	boolean validateFLSABeginTime(Time flsaBeginTime) {
47  		boolean valid = true;
48  		if (flsaBeginTime == null) {
49  			this.putFieldError("flsaBeginTime", "error.required",
50  					"FLSA Begin Time");
51  			valid = false;
52  		}
53  		return valid;
54  	}
55  
56  }