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: package org.kuali.module.kra.budget.rules.event;
17:
18: import java.util.ArrayList;
19: import java.util.List;
20:
21: import org.kuali.core.document.Document;
22: import org.kuali.core.rule.BusinessRule;
23: import org.kuali.core.rule.event.KualiDocumentEventBase;
24: import org.kuali.module.kra.budget.rules.budget.BudgetDocumentRule;
25:
26: /**
27: * Class capturing an update nonpersonnel event.
28: */
29: public class UpdateNonpersonnelEventBase extends KualiDocumentEventBase
30: implements UpdateNonpersonnelEvent {
31:
32: private final List nonpersonnelItems;
33:
34: /**
35: * Constructs a UpdateNonpersonnelEventBase.java.
36: *
37: * @param description
38: * @param errorPathPrefix
39: * @param document
40: */
41: public UpdateNonpersonnelEventBase(String errorPathPrefix,
42: Document document, List nonpersonnelItems) {
43: super ("adding periodLine to document "
44: + getDocumentId(document), errorPathPrefix, document);
45:
46: // by doing a deep copy, we are ensuring that the business rule class can't update
47: // the original object by reference
48: this .nonpersonnelItems = new ArrayList(nonpersonnelItems);
49: }
50:
51: /**
52: * Constructs an AddAccountingLineEvent for the given document and accountingLine
53: *
54: * @param document
55: * @param accountingLine
56: */
57: public UpdateNonpersonnelEventBase(Document document,
58: List nonpersonnelItems) {
59: this ("", document, nonpersonnelItems);
60: }
61:
62: /**
63: * @see org.kuali.module.kra.budget.rules.event.UpdateNonpersonnelEvent#getNewNonpersonnelItems()
64: */
65: public List getNonpersonnelItems() {
66: // TODO Auto-generated method stub
67: return this .nonpersonnelItems;
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: .processUpdateNonpersonnelBusinessRules(getDocument(),
83: getNonpersonnelItems());
84: }
85:
86: }
|