01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.purap.rule.event;
17:
18: import org.kuali.core.document.Document;
19: import org.kuali.core.rule.BusinessRule;
20: import org.kuali.core.rule.event.KualiDocumentEventBase;
21: import org.kuali.kfs.KFSConstants;
22: import org.kuali.module.purap.document.AccountsPayableDocument;
23: import org.kuali.module.purap.rule.CalculateAccountsPayableRule;
24:
25: /**
26: * Calculate event for Accounts Payable Document
27: * This could be triggered when a user presses the Calculate button to calculate the doc.
28: */
29: public final class CalculateAccountsPayableEvent extends
30: KualiDocumentEventBase {
31:
32: /**
33: * Overridden constructor.
34: *
35: * @param document the document for this event
36: */
37: public CalculateAccountsPayableEvent(Document document) {
38: this (KFSConstants.EMPTY_STRING, document);
39: }
40:
41: /**
42: * Constructs a CalculateAccountsPayableEvent with the given errorPathPrefix, document, and item.
43: *
44: * @param errorPathPrefix the error path
45: * @param document document the event was invoked upon
46: */
47: public CalculateAccountsPayableEvent(String errorPathPrefix,
48: Document document) {
49: super ("calculating on document " + getDocumentId(document),
50: errorPathPrefix, document);
51: }
52:
53: /**
54: * @see org.kuali.core.rule.event.KualiDocumentEvent#getRuleInterfaceClass()
55: */
56: public Class getRuleInterfaceClass() {
57: return CalculateAccountsPayableRule.class;
58: }
59:
60: /**
61: * @see org.kuali.core.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.core.rule.BusinessRule)
62: */
63: public boolean invokeRuleMethod(BusinessRule rule) {
64: return ((CalculateAccountsPayableRule) rule)
65: .processCalculateAccountsPayableBusinessRules((AccountsPayableDocument) getDocument());
66: }
67: }
|