001 /*
002 * Copyright 2011 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.kfs.fp.document.validation.event;
017
018 import org.kuali.kfs.fp.businessobject.CashDrawer;
019 import org.kuali.kfs.fp.businessobject.CashieringTransaction;
020 import org.kuali.kfs.fp.document.validation.CashManagingRule;
021 import org.kuali.rice.kns.document.Document;
022 import org.kuali.rice.kns.rule.BusinessRule;
023 import org.kuali.rice.kns.rule.event.KualiDocumentEventBase;
024
025 /**
026 * The default implementation of the CashieringTransactionApplicationEvent interface
027 */
028 public class CashieringTransactionApplicationEventBase extends KualiDocumentEventBase implements CashieringTransactionApplicationEvent {
029 private CashieringTransaction cashieringTransaction;
030 private CashDrawer cashDrawer;
031
032 /**
033 * Constructs a CashieringTransactionApplicationEventBase
034 * @param description
035 * @param errorPathPrefix
036 * @param document
037 * @param cashieringTransaction
038 */
039 public CashieringTransactionApplicationEventBase(String description, String errorPathPrefix, Document document, CashDrawer cashDrawer, CashieringTransaction cashieringTransaction) {
040 super(description, errorPathPrefix, document);
041 this.cashieringTransaction = cashieringTransaction;
042 this.cashDrawer = cashDrawer;
043 }
044
045 /**
046 * Returns the cashieringTransaction to validate
047 * @see org.kuali.kfs.fp.document.validation.event.CashieringTransactionApplicationEvent#getCashieringTransaction()
048 */
049 public CashieringTransaction getCashieringTransaction() {
050 return this.cashieringTransaction;
051 }
052
053 /**
054 * Returns the cash drawer the cashiering transaction will apply to
055 * @see org.kuali.kfs.fp.document.validation.event.CashieringTransactionApplicationEvent#getCashDrawer()
056 */
057 public CashDrawer getCashDrawer() {
058 return this.cashDrawer;
059 }
060
061 /**
062 * Returns CashManagingRule.class
063 * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#getRuleInterfaceClass()
064 */
065 public Class getRuleInterfaceClass() {
066 return CashManagingRule.class;
067 }
068
069 /**
070 * Casts the rule to CashManagingRule and calls processCashieringTransactionApplication
071 * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.rice.kns.rule.BusinessRule)
072 */
073 public boolean invokeRuleMethod(BusinessRule rule) {
074 return ((CashManagingRule)rule).processCashieringTransactionApplication(getCashDrawer(), getCashieringTransaction());
075 }
076
077 }