1 /*
2 * Copyright 2009 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
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.ole.fp.document.validation.event;
17
18 import org.kuali.ole.fp.businessobject.CashDrawer;
19 import org.kuali.ole.fp.businessobject.CashieringTransaction;
20 import org.kuali.ole.fp.document.validation.CashManagingRule;
21 import org.kuali.rice.krad.document.Document;
22 import org.kuali.rice.krad.rules.rule.BusinessRule;
23 import org.kuali.rice.krad.rules.rule.event.KualiDocumentEventBase;
24
25 /**
26 * The default implementation of the CashieringTransactionApplicationEvent interface
27 */
28 public class CashieringTransactionApplicationEventBase extends KualiDocumentEventBase implements CashieringTransactionApplicationEvent {
29 private CashieringTransaction cashieringTransaction;
30 private CashDrawer cashDrawer;
31
32 /**
33 * Constructs a CashieringTransactionApplicationEventBase
34 * @param description
35 * @param errorPathPrefix
36 * @param document
37 * @param cashieringTransaction
38 */
39 public CashieringTransactionApplicationEventBase(String description, String errorPathPrefix, Document document, CashDrawer cashDrawer, CashieringTransaction cashieringTransaction) {
40 super(description, errorPathPrefix, document);
41 this.cashieringTransaction = cashieringTransaction;
42 this.cashDrawer = cashDrawer;
43 }
44
45 /**
46 * Returns the cashieringTransaction to validate
47 * @see org.kuali.ole.fp.document.validation.event.CashieringTransactionApplicationEvent#getCashieringTransaction()
48 */
49 public CashieringTransaction getCashieringTransaction() {
50 return this.cashieringTransaction;
51 }
52
53 /**
54 * Returns the cash drawer the cashiering transaction will apply to
55 * @see org.kuali.ole.fp.document.validation.event.CashieringTransactionApplicationEvent#getCashDrawer()
56 */
57 public CashDrawer getCashDrawer() {
58 return this.cashDrawer;
59 }
60
61 /**
62 * Returns CashManagingRule.class
63 * @see org.kuali.rice.krad.rule.event.KualiDocumentEvent#getRuleInterfaceClass()
64 */
65 public Class getRuleInterfaceClass() {
66 return CashManagingRule.class;
67 }
68
69 /**
70 * Casts the rule to CashManagingRule and calls processCashieringTransactionApplication
71 * @see org.kuali.rice.krad.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.rice.krad.rule.BusinessRule)
72 */
73 public boolean invokeRuleMethod(BusinessRule rule) {
74 return ((CashManagingRule)rule).processCashieringTransactionApplication(getCashDrawer(), getCashieringTransaction());
75 }
76
77 }