View Javadoc
1   /*
2    * Copyright 2013 The Kuali Foundation.
3    *
4    * Licensed under the Educational Community License, Version 1.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/ecl1.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.select.document.validation.event;
17  
18  import org.kuali.ole.select.businessobject.OleDisbursementVoucherAccountingLine;
19  import org.kuali.ole.sys.document.validation.event.AttributedDocumentEventBase;
20  import org.kuali.rice.krad.document.Document;
21  import org.kuali.rice.krad.rules.rule.BusinessRule;
22  import org.kuali.rice.krad.rules.rule.event.KualiDocumentEvent;
23  
24  import java.util.List;
25  
26  public class OleDisbursementAccountPercentEvent extends AttributedDocumentEventBase implements KualiDocumentEvent {
27      private final List<OleDisbursementVoucherAccountingLine> accountingDocument;
28  
29      /**
30       * Constructs an AddAccountingLineEvent with the given errorPathPrefix, document, and accountingLine.
31       *
32       * @param errorPathPrefix
33       * @param document
34       * @param accountingLine
35       */
36      public OleDisbursementAccountPercentEvent(String errorPathPrefix, Document document, List<OleDisbursementVoucherAccountingLine> accountingDocument) {
37          super("Accounting Details of" + getDocumentId(document), errorPathPrefix, document);
38          this.accountingDocument = accountingDocument;
39      }
40  
41      /**
42       * @see org.kuali.rice.kns.rule.event.AccountingLineEvent#getAccountingLine()
43       */
44      public List<OleDisbursementVoucherAccountingLine> getAccountingDocument() {
45          return accountingDocument;
46      }
47  
48      /**
49       * Overridden to call parent and then clean up the error messages.
50       *
51       * @see org.kuali.ole.sys.document.validation.event.AttributedDocumentEventBase#invokeRuleMethod(org.kuali.rice.kns.rule.BusinessRule)
52       */
53      @Override
54      public boolean invokeRuleMethod(BusinessRule rule) {
55          boolean result = super.invokeRuleMethod(rule);
56          cleanErrorMessages();
57          return result;
58      }
59  
60      /**
61       * Logic to replace generic amount error messages, especially those where extraordinarily large amounts caused format errors
62       */
63      public void cleanErrorMessages() {
64      }
65  
66  }