View Javadoc

1   /**
2    * Copyright 2005-2013 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.service;
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.event.AddAdHocRoutePersonEvent;
21  import org.kuali.rice.krad.rules.rule.event.AddAdHocRouteWorkgroupEvent;
22  import org.kuali.rice.krad.rules.rule.event.KualiDocumentEvent;
23  
24  import java.util.List;
25  
26  
27  /**
28   * Defines the interface to the business-rule evaluation service, used to evauluate document-type-specific business rules using
29   * document-related events to drive the process.
30   */
31  public interface KualiRuleService {
32  
33      /**
34       * Retrieves and instantiates the businessRulesClass associated with the event's document type (if any), and calls the
35       * appropriate process* method of that businessRule for handling the given event type. This is a helper method that takes in the
36       * generic KualiDocumentEvent class and determines which event call to make.
37       * 
38       * @param event
39       * @return true if no rule is applied, or all rules are applied successfully, false otherwise
40       */
41      public boolean applyRules(KualiDocumentEvent event);
42  
43      /**
44       * Builds a list containing ad hoc route person events appropriate for the context.
45       * 
46       * @param document
47       * @return List
48       */
49      public List<AddAdHocRoutePersonEvent> generateAdHocRoutePersonEvents(Document document);
50  
51      /**
52       * Builds a list containing ad hoc route workgroup events appropriate for the context.
53       * 
54       * @param document
55       * @return List
56       */
57      public List<AddAdHocRouteWorkgroupEvent> generateAdHocRouteWorkgroupEvents(Document document);
58  
59      /**
60       * Allows code in actions or business objects to directly access rule methods in the class.
61       * 
62       * @param document
63       * @param ruleInterface
64       * @return BusinessRule
65       */
66      public BusinessRule getBusinessRulesInstance(Document document, Class<? extends BusinessRule> ruleInterface);
67  }