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.rules.rule.BusinessRule; 19 20 import java.util.List; 21 import java.util.Map; 22 23 /** 24 * class representing the rule event to process a business rule 25 * 26 * @author Kuali Rice Team (rice.collab@kuali.org) 27 */ 28 public interface RuleEvent { 29 30 /** 31 * The name of the event. 32 * 33 * @return String 34 */ 35 String getName(); 36 37 /** 38 * A description of the event. 39 * 40 * @return String 41 */ 42 String getDescription(); 43 44 /** 45 * @return errorPathPrefix for this event 46 */ 47 String getErrorPathPrefix(); 48 49 /** 50 * Returns the interface that classes must implement to receive this event. 51 * 52 * @return rule interface 53 */ 54 Class<? extends BusinessRule> getRuleInterfaceClass(); 55 56 /** 57 * The method name of the rule class to invoke. 58 * 59 * <p>If the rule method name is specified, then that business rule method is invoked to apply custom 60 * rules, else the default method is invoked.</p> 61 * 62 * @return the name of the method 63 */ 64 String getRuleMethodName(); 65 66 /** 67 * The map that holds the data that to be validated. 68 * 69 * @return the map containing the data 70 */ 71 Map<String, Object> getFacts(); 72 73 /** 74 * Validates the event has all the necessary properties. 75 */ 76 void validate(); 77 78 /** 79 * Invokes the event handling method on the rule object. 80 * 81 * @param rule business rule 82 * @return true if the rule matches 83 */ 84 boolean invokeRuleMethod(BusinessRule rule); 85 86 /** 87 * This will return a list of events that are spawned from this event. 88 * 89 * @return list of events 90 */ 91 List<RuleEvent> generateEvents(); 92 }