View Javadoc
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.module.purap.document.validation.impl;
17  
18  import org.kuali.ole.module.purap.businessobject.PurApItem;
19  import org.kuali.ole.sys.context.SpringContext;
20  import org.kuali.ole.sys.document.validation.GenericValidation;
21  import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
22  import org.kuali.rice.coreservice.framework.parameter.ParameterService;
23  import org.kuali.rice.kew.api.doctype.DocumentTypeService;
24  import org.kuali.rice.kns.service.DataDictionaryService;
25  
26  public class PurchasingAccountsPayableNewIndividualItemValidation extends GenericValidation {
27  
28      private DataDictionaryService dataDictionaryService;
29      private ParameterService parameterService;
30      private PurApItem itemForValidation;
31      private PurchasingAccountsPayableBelowTheLineValuesValidation belowTheLineValuesValidation;
32  
33      public boolean validate(AttributedDocumentEvent event) {
34          boolean valid = true;
35          if (itemForValidation.getItemType().isAdditionalChargeIndicator()) {
36              belowTheLineValuesValidation.setItemForValidation(itemForValidation);
37              valid &= belowTheLineValuesValidation.validate(event);
38          }
39          return valid;
40      }
41  
42      protected String getDocumentTypeLabel(String documentTypeName) {
43          return SpringContext.getBean(DocumentTypeService.class).getDocumentTypeByName(documentTypeName).getLabel();
44      }
45  
46      public ParameterService getParameterService() {
47          return parameterService;
48      }
49  
50      public void setParameterService(ParameterService parameterService) {
51          this.parameterService = parameterService;
52      }
53  
54      public PurApItem getItemForValidation() {
55          return itemForValidation;
56      }
57  
58      public void setItemForValidation(PurApItem itemForValidation) {
59          this.itemForValidation = itemForValidation;
60      }
61  
62      public DataDictionaryService getDataDictionaryService() {
63          return dataDictionaryService;
64      }
65  
66      public void setDataDictionaryService(DataDictionaryService dataDictionaryService) {
67          this.dataDictionaryService = dataDictionaryService;
68      }
69  
70      public PurchasingAccountsPayableBelowTheLineValuesValidation getBelowTheLineValuesValidation() {
71          return belowTheLineValuesValidation;
72      }
73  
74      public void setBelowTheLineValuesValidation(PurchasingAccountsPayableBelowTheLineValuesValidation belowTheLineValuesValidation) {
75          this.belowTheLineValuesValidation = belowTheLineValuesValidation;
76      }
77  
78  
79  }