001/**
002 * Copyright 2005-2018 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.rice.krad.rules.rule.event;
017
018import org.kuali.rice.krad.document.Document;
019import org.kuali.rice.krad.rules.rule.BusinessRule;
020import org.kuali.rice.krad.rules.rule.DocumentAuditRule;
021
022/**
023 * Event class for document audit
024 *
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 *
027 */
028public class DocumentAuditEvent extends DocumentEventBase {
029
030    /**
031     * Constructs a RunAuditEvent with the given errorPathPrefix and document.
032     *
033     * @param errorPathPrefix
034     * @param document
035     */
036    public DocumentAuditEvent(String errorPathPrefix, Document document) {
037        super("Running audit on " + DocumentEventBase.getDocumentId(document), errorPathPrefix, document);
038    }
039
040    /**
041     * Constructs a RunAuditEvent with the given document.
042     *
043     * @param document
044     */
045    public DocumentAuditEvent(Document document) {
046        this("", document);
047    }
048
049    /**
050     * @see org.kuali.rice.krad.rules.rule.event.RuleEvent#getRuleInterfaceClass()
051     */
052    public Class<? extends BusinessRule> getRuleInterfaceClass() {
053        return DocumentAuditRule.class;
054    }
055
056    /**
057     * @see org.kuali.rice.krad.rules.rule.event.RuleEvent#invokeRuleMethod(org.kuali.rice.krad.rules.rule.BusinessRule)
058     */
059    public boolean invokeRuleMethod(BusinessRule rule) {
060        return ((DocumentAuditRule) rule).processRunAuditBusinessRules(getDocument());
061    }
062}
063