001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     * http://www.opensource.org/licenses/ecl2.php
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.kfs.fp.document.validation.impl;
017    
018    import org.kuali.kfs.fp.document.DisbursementVoucherDocument;
019    import org.kuali.kfs.sys.KFSPropertyConstants;
020    import org.kuali.kfs.sys.document.AccountingDocument;
021    import org.kuali.kfs.sys.document.validation.GenericValidation;
022    import org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent;
023    import org.kuali.kfs.sys.document.validation.impl.BankCodeValidation;
024    
025    public class DisbursementVoucherBankCodeValidation extends GenericValidation {
026        private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DisbursementVoucherBankCodeValidation.class);
027    
028        private AccountingDocument accountingDocumentForValidation;
029    
030        /**
031         * @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
032         */
033        public boolean validate(AttributedDocumentEvent event) {
034            LOG.debug("validate start");
035            
036            DisbursementVoucherDocument dvDocument = (DisbursementVoucherDocument) accountingDocumentForValidation;
037            
038            boolean isValid = BankCodeValidation.validate(dvDocument.getDisbVchrBankCode(), KFSPropertyConstants.DISB_VCHR_BANK_CODE, false, true);
039    
040            return isValid;
041        }
042    
043        /**
044         * Sets the accountingDocumentForValidation attribute value.
045         * @param accountingDocumentForValidation The accountingDocumentForValidation to set.
046         */
047        public void setAccountingDocumentForValidation(AccountingDocument accountingDocumentForValidation) {
048            this.accountingDocumentForValidation = accountingDocumentForValidation;
049        }
050    
051        /**
052         * Gets the accountingDocumentForValidation attribute. 
053         * @return Returns the accountingDocumentForValidation.
054         */
055        public AccountingDocument getAccountingDocumentForValidation() {
056            return accountingDocumentForValidation;
057        }
058    }