View Javadoc
1   /*
2    * Copyright 2012 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.NonCheckDisbursementDocument;
19  import org.kuali.ole.sys.OLEPropertyConstants;
20  import org.kuali.ole.sys.document.AccountingDocument;
21  import org.kuali.ole.sys.document.validation.GenericValidation;
22  import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
23  import org.kuali.ole.sys.document.validation.impl.BankCodeValidation;
24  
25  public class NonCheckDisbursementBankValidation extends GenericValidation {
26      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(NonCheckDisbursementBankValidation.class);
27  
28      private AccountingDocument accountingDocumentForValidation;
29  
30      /**
31       * @see org.kuali.ole.sys.document.validation.Validation#validate(org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent)
32       */
33      @Override
34      public boolean validate(AttributedDocumentEvent event) {
35          LOG.debug("validate start");
36          
37          NonCheckDisbursementDocument nonCheckDisbursement = (NonCheckDisbursementDocument) accountingDocumentForValidation;
38          
39          boolean isValid = BankCodeValidation.validate(nonCheckDisbursement, nonCheckDisbursement.getFinancialDocumentBankCode(), OLEPropertyConstants.FINANCIAL_DOCUMENT_BANK_CODE, false, true);
40  
41          return isValid;
42      }
43  
44      /**
45       * Sets the accountingDocumentForValidation attribute value.
46       * @param accountingDocumentForValidation The accountingDocumentForValidation to set.
47       */
48      public void setAccountingDocumentForValidation(AccountingDocument accountingDocumentForValidation) {
49          this.accountingDocumentForValidation = accountingDocumentForValidation;
50      }
51  
52      /**
53       * Gets the accountingDocumentForValidation attribute. 
54       * @return Returns the accountingDocumentForValidation.
55       */
56      public AccountingDocument getAccountingDocumentForValidation() {
57          return accountingDocumentForValidation;
58      }
59  
60  }