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 personnel event.
28: */
29: public class UpdatePersonnelEventBase extends KualiDocumentEventBase
30: implements UpdatePersonnelEvent {
31:
32: private final List personnel;
33:
34: /**
35: * Constructs a UpdateNonpersonnelEventBase.java.
36: *
37: * @param description
38: * @param errorPathPrefix
39: * @param document
40: */
41: public UpdatePersonnelEventBase(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: /**
52: * Constructs an AddAccountingLineEvent for the given document and accountingLine
53: *
54: * @param document
55: * @param accountingLine
56: */
57: public UpdatePersonnelEventBase(Document document, List personnel) {
58: this ("", document, personnel);
59: }
60:
61: /**
62: * @see org.kuali.module.kra.budget.rules.event.UpdateNonpersonnelEvent#getNewNonpersonnelItems()
63: */
64: public List getPersonnel() {
65: // TODO Auto-generated method stub
66: return this .personnel;
67: }
68:
69: /**
70: * @see org.kuali.core.rule.event.KualiDocumentEvent#getRuleInterfaceClass()
71: */
72: public Class getRuleInterfaceClass() {
73: return BudgetDocumentRule.class;
74: }
75:
76: /**
77: * @see org.kuali.core.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.core.rule.BusinessRule)
78: */
79: public boolean invokeRuleMethod(BusinessRule rule) {
80: return ((BudgetDocumentRule) rule)
81: .processUpdatePersonnelBusinessRules(getDocument());
82: }
83:
84: }
|