kuali/kc — pull request #707 by blackcathacker (2014-09-10 03:42:39+00:00)
Title: Business Rules Start and Example

In order to facilitate the removal of the BudgetDocument we need a new way to handle business rules as the current KualiRulesService only works with Documents. This is an attempt to handle this using a more event driven and spring based system. Business rules classes will be defined using the KcBusinessRule annotation and extend KcBusinessRuleBase. Each business rule method will be annotated with KcEventMethod and the annotation will declare which "events" the method is intended to respond too. By extending KcBusinessRuleBase the class and all associated KcEventMethods will be automatically registered with the KcBusinessRulesService once loaded by Spring. In order to call the business rule, you simply create the appropriate KcEvent that defines a specific event name and includes necessary data required for the event/rule to process.

This is a work in progress and this is more intended for design review than an actual PR. Additional work is needed to validate business rules when they are registered to determine the appropriate parameter and return value. And when calling applyRules we need more processing to detect incorrect event and provide reasonable exceptions.