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.workschedule.validation;
17  
18  import org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase;
19  
20  public class WorkScheduleRule extends MaintenanceDocumentRuleBase {
21  
22  //	protected boolean validateWorkArea(WorkSchedule workSchedule ) {
23  //		boolean valid = false;
24  //		LOG.debug("Validating workarea: " + workSchedule.getWorkArea());
25  //		WorkArea workArea = KNSServiceLocator.getBusinessObjectService()
26  //				.findBySinglePrimaryKey(WorkArea.class, workSchedule.getWorkArea());
27  //		if (workArea != null) {
28  //
29  //			valid = true;
30  //			LOG.debug("found workarea.");
31  //		} else {
32  //			this.putFieldError("workArea", "error.existence", "workarea '"
33  //					+ workSchedule.getWorkArea()+ "'");
34  //		}
35  //		return valid;
36  //	}
37  //
38  //	protected boolean validateDepartment(WorkSchedule workSchedule) {
39  //		boolean valid = false;
40  //
41  //		if (workSchedule.getDept().equals(TkConstants.WILDCARD_CHARACTER)) {
42  //			valid = true;
43  //		} else {
44  //			LOG.debug("Validating dept: " + workSchedule.getDept());
45  //			// TODO: We may need a full DAO that handles bo lookups at some point,
46  //			// but we can use the provided one:
47  //			Department dept = KNSServiceLocator.getBusinessObjectService()
48  //					.findBySinglePrimaryKey(Department.class, workSchedule.getDept());
49  //			if (dept != null) {
50  //				valid = true;
51  //				LOG.debug("found department.");
52  //			} else {
53  //				this.putFieldError("deptId", "error.existence", "department '"
54  //						+ workSchedule.getDept() + "'");
55  //			}
56  //		}
57  //		return valid;
58  //	}
59  //
60  //	/**
61  //	 * It looks like the method that calls this class doesn't actually care
62  //	 * about the return type.
63  //	 */
64  //	@Override
65  //	protected boolean processCustomRouteDocumentBusinessRules(
66  //			MaintenanceDocument document) {
67  //		boolean valid = false;
68  //
69  //		LOG.debug("entering custom validation for WorkSchedule");
70  //		PersistableBusinessObject pbo = this.getNewBo();
71  //		if (pbo instanceof WorkSchedule) {
72  //			WorkSchedule workSchedule = (WorkSchedule) pbo;
73  //
74  //			if (workSchedule != null) {
75  //				valid = true;
76  //				valid &= this.validateWorkArea(workSchedule);
77  //				valid &= this.validateDepartment(workSchedule);
78  //
79  //			}
80  //		}
81  //		return valid;
82  //	}
83  //
84  //	@Override
85  //	protected boolean processCustomApproveDocumentBusinessRules(
86  //			MaintenanceDocument document) {
87  //		return super.processCustomApproveDocumentBusinessRules(document);
88  //	}
89  //
90  //	@Override
91  //	protected boolean processCustomRouteDocumentBusinessRules(
92  //			MaintenanceDocument document) {
93  //		return super.processCustomRouteDocumentBusinessRules(document);
94  //	}
95  }