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 a save personnel event.
28: */
29: public class SavePersonnelEventBase extends KualiDocumentEventBase
30: implements SavePersonnelEvent {
31:
32: private final List personnel;
33:
34: /**
35: * Constructs a SavePersonnelEventBase.java.
36: *
37: * @param description
38: * @param errorPathPrefix
39: * @param document
40: */
41: public SavePersonnelEventBase(String errorPathPrefix,
42: Document document, List personnel) {
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 .personnel = new ArrayList(personnel);
49: }
50:
51: public SavePersonnelEventBase(Document document, List personnel) {
52: this ("", document, personnel);
53: }
54:
55: /**
56: * @see org.kuali.module.kra.budget.rules.event.UpdateNonpersonnelEvent#getNewNonpersonnelItems()
57: */
58: public List getPersonnel() {
59: // TODO Auto-generated method stub
60: return this .personnel;
61: }
62:
63: /**
64: * @see org.kuali.core.rule.event.KualiDocumentEvent#getRuleInterfaceClass()
65: */
66: public Class getRuleInterfaceClass() {
67: return BudgetDocumentRule.class;
68: }
69:
70: /**
71: * @see org.kuali.core.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.core.rule.BusinessRule)
72: */
73: public boolean invokeRuleMethod(BusinessRule rule) {
74: return ((BudgetDocumentRule) rule)
75: .processSavePersonnelBusinessRules(personnel);
76: }
77: }
|