/*
* The Kuali Financial System, a comprehensive financial management system for higher education.
*
* Copyright 2005-2014 The Kuali Foundation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.kuali.kfs.fp.document.validation.impl;
import org.kuali.kfs.fp.document.CashReceiptDocument;
import org.kuali.kfs.fp.document.service.CashReceiptService;
import org.kuali.kfs.sys.document.validation.GenericValidation;
import org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent;
/**
* Validation that checks all of the various cash totals on a cash receipt document.
*/
public class CashReceiptCashTotalsValidation extends GenericValidation {
private CashReceiptDocument cashReceiptDocumentForValidation;
private CashReceiptService cashReceiptService;
/**
* Uses the CashReceiptService.areCashAmountsInvalid method to check the cash detail and total amounts.
* @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
*/
public boolean validate(AttributedDocumentEvent event) {
return !getCashReceiptService().areCashAmountsInvalid(getCashReceiptDocumentForValidation());
}
/**
* Gets the cashReceiptDocumentForValidation attribute.
* @return Returns the cashReceiptDocumentForValidation.
*/
public CashReceiptDocument getCashReceiptDocumentForValidation() {
return cashReceiptDocumentForValidation;
}
/**
* Sets the cashReceiptDocumentForValidation attribute value.
* @param cashReceiptDocumentForValidation The cashReceiptDocumentForValidation to set.
*/
public void setCashReceiptDocumentForValidation(CashReceiptDocument cashReceiptDocumentForValidation) {
this.cashReceiptDocumentForValidation = cashReceiptDocumentForValidation;
}
/**
* Gets the cashReceiptService attribute.
* @return Returns the cashReceiptService.
*/
public CashReceiptService getCashReceiptService() {
return cashReceiptService;
}
/**
* Sets the cashReceiptService attribute value.
* @param cashReceiptService The cashReceiptService to set.
*/
public void setCashReceiptService(CashReceiptService cashReceiptService) {
this.cashReceiptService = cashReceiptService;
}
}