A business rule is a statement that defines or constrains some aspect of a business by asserting control over some behavior of that business.
A business rule officiates over frequently changing business practices and can come from within the company or be mandated from outside, typically by regulatory agencies. Typical uses for business rules include the following:
The objects used to implement a business rule contain methods and attributes used by the Business Rule Beans (BRBeans) run-time environment, its administrative component, or both. An externalized business rule is implemented as a pair of objects:
The Rule is an entity enterprise bean that stores all of the persistent data for the business rule. This is the object that the trigger point framework code actually deals with directly. When a trigger point is invoked, the internal framework code performs a query to find the Rule object or objects representing the business rules to be triggered. Once the Rules are found, the framework code determines where the Rule is invoked, either local to the trigger point or remotely on the application server. Then, it invokes the fire method on either the Rule enterprise bean itself (for remote triggering) or on a local copy of the enterprise bean (for local triggering) to perform the function of the business rule.
The class name of the business rule's RuleImplementor is stored persistently in the Rule. The RuleImplementor is a transient object (not managed by the application server) that the Rule instantiates and then uses to do the actual work. When the fire() method is called on the Rule object, the Rule object combines its persistent set of values with the parameters it received on invocation. This creates the parameter list for the RuleImplementor prior to invoking fire() on the RuleImplementor with this parameter list. The actual execution of the RuleImplementor algorithm can take place either remotely (within the application server where the BRBeans enterprise beans are installed) or locally (within the Java virtual machine (JVM) where the trigger point was called).