1 /*
2 * Copyright 2008 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.ole.fp.document.validation.impl;
17
18 import org.kuali.ole.fp.document.CashReceiptDocument;
19 import org.kuali.ole.fp.document.service.CashReceiptService;
20 import org.kuali.ole.sys.document.validation.GenericValidation;
21 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
22
23 /**
24 * Validation that checks all of the various cash totals on a cash receipt document.
25 */
26 public class CashReceiptCashTotalsValidation extends GenericValidation {
27 private CashReceiptDocument cashReceiptDocumentForValidation;
28 private CashReceiptService cashReceiptService;
29
30 /**
31 * Uses the CashReceiptService.areCashTotalsInvalid method to check the cash totals.
32 * @see org.kuali.ole.sys.document.validation.Validation#validate(org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent)
33 */
34 public boolean validate(AttributedDocumentEvent event) {
35 return !getCashReceiptService().areCashTotalsInvalid(getCashReceiptDocumentForValidation());
36 }
37
38 /**
39 * Gets the cashReceiptDocumentForValidation attribute.
40 * @return Returns the cashReceiptDocumentForValidation.
41 */
42 public CashReceiptDocument getCashReceiptDocumentForValidation() {
43 return cashReceiptDocumentForValidation;
44 }
45
46 /**
47 * Sets the cashReceiptDocumentForValidation attribute value.
48 * @param cashReceiptDocumentForValidation The cashReceiptDocumentForValidation to set.
49 */
50 public void setCashReceiptDocumentForValidation(CashReceiptDocument cashReceiptDocumentForValidation) {
51 this.cashReceiptDocumentForValidation = cashReceiptDocumentForValidation;
52 }
53
54 /**
55 * Gets the cashReceiptService attribute.
56 * @return Returns the cashReceiptService.
57 */
58 public CashReceiptService getCashReceiptService() {
59 return cashReceiptService;
60 }
61
62 /**
63 * Sets the cashReceiptService attribute value.
64 * @param cashReceiptService The cashReceiptService to set.
65 */
66 public void setCashReceiptService(CashReceiptService cashReceiptService) {
67 this.cashReceiptService = cashReceiptService;
68 }
69 }