001/** 002 * Copyright 2005-2018 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krad.rules.rule.event; 017 018import org.kuali.rice.krad.rules.rule.BusinessRule; 019 020import java.util.List; 021import java.util.Map; 022 023/** 024 * class representing the rule event to process a business rule 025 * 026 * @author Kuali Rice Team (rice.collab@kuali.org) 027 */ 028public interface RuleEvent { 029 030 /** 031 * The name of the event. 032 * 033 * @return String 034 */ 035 String getName(); 036 037 /** 038 * A description of the event. 039 * 040 * @return String 041 */ 042 String getDescription(); 043 044 /** 045 * @return errorPathPrefix for this event 046 */ 047 String getErrorPathPrefix(); 048 049 /** 050 * Returns the interface that classes must implement to receive this event. 051 * 052 * @return rule interface 053 */ 054 Class<? extends BusinessRule> getRuleInterfaceClass(); 055 056 /** 057 * The method name of the rule class to invoke. 058 * 059 * <p>If the rule method name is specified, then that business rule method is invoked to apply custom 060 * rules, else the default method is invoked.</p> 061 * 062 * @return the name of the method 063 */ 064 String getRuleMethodName(); 065 066 /** 067 * The map that holds the data that to be validated. 068 * 069 * @return the map containing the data 070 */ 071 Map<String, Object> getFacts(); 072 073 /** 074 * Validates the event has all the necessary properties. 075 */ 076 void validate(); 077 078 /** 079 * Invokes the event handling method on the rule object. 080 * 081 * @param rule business rule 082 * @return true if the rule matches 083 */ 084 boolean invokeRuleMethod(BusinessRule rule); 085 086 /** 087 * This will return a list of events that are spawned from this event. 088 * 089 * @return list of events 090 */ 091 List<RuleEvent> generateEvents(); 092}