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