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 */
016package org.kuali.ole.select.document.validation.event;
017
018import org.kuali.ole.select.businessobject.OleInvoiceItem;
019import org.kuali.ole.select.document.validation.impl.OleValidationRule;
020import org.kuali.ole.select.document.validation.impl.OleValidationRuleBase;
021import org.kuali.rice.krad.document.Document;
022import org.kuali.rice.krad.rules.rule.BusinessRule;
023import org.kuali.rice.krad.rules.rule.event.KualiDocumentEventBase;
024
025public class OleDiscountInvoiceEvent extends KualiDocumentEventBase {
026
027    private OleInvoiceItem payItem;
028
029    protected OleDiscountInvoiceEvent(String errorPathPrefix, Document document) {
030        super("Creating Note Tag" + getDocumentId(document), errorPathPrefix, document);
031    }
032
033    public OleDiscountInvoiceEvent(Document document, OleInvoiceItem payItem) {
034        this("", document);
035        this.payItem = payItem;
036    }
037
038    @Override
039    public Class getRuleInterfaceClass() {
040        return OleValidationRuleBase.class;
041    }
042
043    @Override
044    public boolean invokeRuleMethod(BusinessRule rule) {
045        return ((OleValidationRule) rule).processCustomAddDiscountInvoiceBusinessRules(document, payItem);
046    }
047
048    public OleInvoiceItem getPayItem() {
049        return payItem;
050    }
051
052    public void setPayItem(OleInvoiceItem payItem) {
053        this.payItem = payItem;
054    }
055
056
057}