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.kfs.rule.event;
17:
18: import org.kuali.core.document.Document;
19: import org.kuali.core.rule.BusinessRule;
20: import org.kuali.kfs.bo.AccountingLine;
21: import org.kuali.kfs.document.AccountingDocument;
22: import org.kuali.kfs.rule.DeleteAccountingLineRule;
23:
24: /**
25: * This class represents the delete accounting line event. This could be triggered when a user presses the delete button for a given
26: * document's accounting line.
27: */
28: public final class DeleteAccountingLineEvent extends
29: AccountingLineEventBase {
30:
31: private final boolean lineWasAlreadyDeletedFromDocument;
32:
33: /**
34: * Constructs a DeleteAccountingLineEvent with the given errorPathPrefix, document, and accountingLine.
35: *
36: * @param errorPathPrefix
37: * @param document
38: * @param accountingLine
39: */
40: public DeleteAccountingLineEvent(String errorPathPrefix,
41: Document document, AccountingLine accountingLine,
42: boolean lineWasAlreadyDeletedFromDocument) {
43: super ("deleting accountingLine from document "
44: + getDocumentId(document), errorPathPrefix, document,
45: accountingLine);
46: this .lineWasAlreadyDeletedFromDocument = lineWasAlreadyDeletedFromDocument;
47: }
48:
49: /**
50: * @see org.kuali.core.rule.event.KualiDocumentEvent#getRuleInterfaceClass()
51: */
52: public Class getRuleInterfaceClass() {
53: return DeleteAccountingLineRule.class;
54: }
55:
56: /**
57: * @see org.kuali.core.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.core.rule.BusinessRule)
58: */
59: public boolean invokeRuleMethod(BusinessRule rule) {
60: return ((DeleteAccountingLineRule) rule)
61: .processDeleteAccountingLineBusinessRules(
62: (AccountingDocument) getDocument(),
63: getAccountingLine(),
64: lineWasAlreadyDeletedFromDocument);
65: }
66: }
|