View Javadoc
1   /**
2    * Copyright 2005-2016 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.rice.krad.rules.rule.event;
17  
18  import org.kuali.rice.krad.document.Document;
19  import org.kuali.rice.krad.rules.rule.BusinessRule;
20  import org.kuali.rice.krad.rules.rule.DocumentAuditRule;
21  
22  /**
23   * Event class for document audit
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   *
27   */
28  public class DocumentAuditEvent extends DocumentEventBase {
29  
30      /**
31       * Constructs a RunAuditEvent with the given errorPathPrefix and document.
32       *
33       * @param errorPathPrefix
34       * @param document
35       */
36      public DocumentAuditEvent(String errorPathPrefix, Document document) {
37          super("Running audit on " + DocumentEventBase.getDocumentId(document), errorPathPrefix, document);
38      }
39  
40      /**
41       * Constructs a RunAuditEvent with the given document.
42       *
43       * @param document
44       */
45      public DocumentAuditEvent(Document document) {
46          this("", document);
47      }
48  
49      /**
50       * @see org.kuali.rice.krad.rules.rule.event.RuleEvent#getRuleInterfaceClass()
51       */
52      public Class<? extends BusinessRule> getRuleInterfaceClass() {
53          return DocumentAuditRule.class;
54      }
55  
56      /**
57       * @see org.kuali.rice.krad.rules.rule.event.RuleEvent#invokeRuleMethod(org.kuali.rice.krad.rules.rule.BusinessRule)
58       */
59      public boolean invokeRuleMethod(BusinessRule rule) {
60          return ((DocumentAuditRule) rule).processRunAuditBusinessRules(getDocument());
61      }
62  }
63