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  
19  import org.kuali.ole.module.purap.PurapConstants;
20  import org.kuali.ole.module.purap.document.PurchasingAccountsPayableDocument;
21  import org.kuali.rice.krad.document.Document;
22  
23  /**
24   * Business PreRules applicable to Purchasing documents
25   */
26  public class RequisitionDocumentPreRules extends PurchasingDocumentPreRulesBase {
27  
28      /**
29       * @see org.kuali.rice.kns.rules.PromptBeforeValidationBase#doRules(org.kuali.rice.krad.document.Document)
30       */
31      @Override
32      public boolean doPrompts(Document document) {
33          boolean preRulesOK = super.doPrompts(document);
34  
35          PurchasingAccountsPayableDocument purapDocument = (PurchasingAccountsPayableDocument) document;
36  
37          if (!purapDocument.isUseTaxIndicator()) {
38              preRulesOK &= checkForTaxRecalculation(purapDocument);
39          }
40  
41          return preRulesOK;
42      }
43  
44      @Override
45      protected boolean checkCAMSWarningStatus(PurchasingAccountsPayableDocument purapDocument) {
46          return PurapConstants.CAMSWarningStatuses.REQUISITION_STATUS_WARNING_NO_CAMS_DATA.contains(purapDocument.getApplicationDocumentStatus());
47      }
48  
49  }