View Javadoc
1   /**
2    * Copyright 2005-2015 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.BusinessRule;
21  import org.kuali.rice.krad.rules.rule.CompleteDocumentRule;
22  
23  import java.util.ArrayList;
24  import java.util.List;
25  
26  /**
27   * Complete document event
28   *
29   * @author Kuali Rice Team (kuali-rice@googlegroups.com)
30   */
31  public class CompleteDocumentEvent extends KualiDocumentEventBase {
32  
33      /**
34       * Constructs a RouteDocumentEvent with the specified errorPathPrefix and document
35       *
36       * @param errorPathPrefix
37       * @param document
38       */
39      public CompleteDocumentEvent(String errorPathPrefix, Document document) {
40          super("creating complete event for document " + getDocumentId(document), errorPathPrefix, document);
41      }
42  
43      /**
44       * Constructs a RouteDocumentEvent with the given document
45       *
46       * @param document
47       */
48      public CompleteDocumentEvent(Document document) {
49          this("", document);
50      }
51  
52      /**
53       * @see KualiDocumentEvent#getRuleInterfaceClass()
54       */
55      public Class getRuleInterfaceClass() {
56          return CompleteDocumentRule.class;
57      }
58  
59      /**
60       * @see KualiDocumentEvent#invokeRuleMethod(org.kuali.rice.krad.rules.rule.BusinessRule)
61       */
62      public boolean invokeRuleMethod(BusinessRule rule) {
63          return ((CompleteDocumentRule) rule).processCompleteDocument(document);
64      }
65  
66      /**
67       * @see KualiDocumentEvent#generateEvents()
68       */
69      public List generateEvents() {
70          List events = new ArrayList();
71          events.add(new RouteDocumentEvent(getDocument()));
72          return events;
73      }
74  }