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.module.bc.document.validation.event;
017    
018    import org.kuali.kfs.module.bc.document.BudgetConstructionDocument;
019    import org.kuali.kfs.module.bc.document.validation.BudgetExpansionRule;
020    import org.kuali.rice.kns.document.Document;
021    import org.kuali.rice.kns.rule.BusinessRule;
022    import org.kuali.rice.kns.rule.event.KualiDocumentEventBase;
023    
024    /**
025     * Base class for expansion rule events. 
026     */
027    public abstract class BudgetExpansionEvent extends KualiDocumentEventBase {
028        private BudgetConstructionDocument budgetConstructionDocument;
029    
030        /**
031         * Constructs a BudgetExpansionEvent.java.
032         */
033        public BudgetExpansionEvent(String description, String errorPathPrefix, Document document) {
034            super(description, errorPathPrefix, document);
035            this.budgetConstructionDocument = (BudgetConstructionDocument) document;
036        }
037    
038        /**
039         * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#getRuleInterfaceClass()
040         */
041        public Class getRuleInterfaceClass() {
042            return BudgetExpansionRule.class;
043        }
044    
045        /**
046         * @see org.kuali.rice.kns.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.rice.kns.rule.BusinessRule)
047         */
048        public boolean invokeRuleMethod(BusinessRule rule) {
049            return ((BudgetExpansionRule) rule).processExpansionRule(this);
050        }
051    
052        public abstract Class getExpansionRuleInterfaceClass();
053    
054        public abstract boolean invokeExpansionRuleMethod(BusinessRule rule);
055    
056        /**
057         * Gets the budgetConstructionDocument attribute.
058         * 
059         * @return Returns the budgetConstructionDocument.
060         */
061        public BudgetConstructionDocument getBudgetConstructionDocument() {
062            return budgetConstructionDocument;
063        }
064    
065        /**
066         * Sets the budgetConstructionDocument attribute value.
067         * 
068         * @param budgetConstructionDocument The budgetConstructionDocument to set.
069         */
070        public void setBudgetConstructionDocument(BudgetConstructionDocument budgetConstructionDocument) {
071            this.budgetConstructionDocument = budgetConstructionDocument;
072        }
073    
074    }