01: /*
02: * Copyright 2006-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: /**
17: *
18: */package org.kuali.module.kra.budget.rules.event;
19:
20: import org.kuali.core.document.Document;
21: import org.kuali.core.rule.BusinessRule;
22: import org.kuali.core.rule.event.KualiDocumentEvent;
23: import org.kuali.core.rule.event.KualiDocumentEventBase;
24: import org.kuali.core.util.ObjectUtils;
25: import org.kuali.module.kra.budget.bo.BudgetIndirectCost;
26: import org.kuali.module.kra.budget.rules.budget.BudgetDocumentRule;
27:
28: /**
29: * Class capturing an update indirect cost event.
30: */
31: public class UpdateIndirectCostEvent extends KualiDocumentEventBase
32: implements KualiDocumentEvent {
33:
34: private BudgetIndirectCost idc;
35:
36: /**
37: * Constructs an event with the given errorPathPrefix, document, and indirectCost object.
38: *
39: * @param errorPathPrefix
40: * @param document
41: * @param accountingLine
42: */
43: public UpdateIndirectCostEvent(String errorPathPrefix,
44: Document document, BudgetIndirectCost budgetIndirectCost) {
45: super ("adding indirectCost to document "
46: + getDocumentId(document), errorPathPrefix, document);
47:
48: // by doing a deep copy, we are ensuring that the business rule class can't update
49: // the original object by reference
50: idc = (BudgetIndirectCost) ObjectUtils
51: .deepCopy(budgetIndirectCost);
52: }
53:
54: /**
55: * Constructs an event for the given document and budget.
56: *
57: * @param document
58: * @param accountingLine
59: */
60: public UpdateIndirectCostEvent(Document document,
61: BudgetIndirectCost budgetIndirectCost) {
62: this ("document.budget.indirectCost", document,
63: budgetIndirectCost);
64: }
65:
66: public BudgetIndirectCost getIndirectCost() {
67: return idc;
68: }
69:
70: /**
71: * @see org.kuali.core.rule.event.KualiDocumentEvent#getRuleInterfaceClass()
72: */
73: public Class getRuleInterfaceClass() {
74: return BudgetDocumentRule.class;
75: }
76:
77: /**
78: * @see org.kuali.core.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.core.rule.BusinessRule)
79: */
80: public boolean invokeRuleMethod(BusinessRule rule) {
81: return ((BudgetDocumentRule) rule)
82: .processSaveIndirectCostBusinessRules(idc);
83: }
84: }
|