1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.kuali.ole.fp.document.validation.impl;
17  
18  import java.util.List;
19  
20  import org.kuali.ole.fp.document.PreEncumbranceDocument;
21  import org.kuali.ole.sys.OLEKeyConstants;
22  import org.kuali.ole.sys.document.validation.GenericValidation;
23  import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
24  import org.kuali.rice.krad.util.GlobalVariables;
25  
26  
27  
28  
29  public class PreEncumbranceRequiredAccountingLinesCountValidation extends GenericValidation {
30      private PreEncumbranceDocument accountingDocumentForValidation;
31  
32      
33  
34  
35  
36  
37      public boolean validate(AttributedDocumentEvent event) {
38          List sourceAccountingLineList = this.accountingDocumentForValidation.getSourceAccountingLines();
39          List targetAccountingLineList = this.accountingDocumentForValidation.getTargetAccountingLines();
40          if (sourceAccountingLineList.size() == 0 && targetAccountingLineList.size() == 0 ) {
41              GlobalVariables.getMessageMap().putError("sourceAccountingLines", OLEKeyConstants.ERROR_DOCUMENT_PRE_ENCUMBRANCE_SINGLE_SECTION_NO_ACCOUNTING_LINES, new String[] { null });
42              return false;
43          }
44          
45          return true;
46      }
47      
48      
49  
50  
51  
52      public PreEncumbranceDocument getAccountingDocumentForValidation() {
53          return accountingDocumentForValidation;
54      }
55  
56      
57  
58  
59  
60      public void setAccountingDocumentForValidation(PreEncumbranceDocument accountingDocumentForValidation) {
61          this.accountingDocumentForValidation = accountingDocumentForValidation;
62      }
63  
64      
65     
66  }