1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Business Logic Components

From grayeagle

Jump to: navigation, search

Business Logic Components are Groovy/Java class files that declare Business Logic Rules for a Domain Object. Business Logic Components parallel the Java Domain Objects - you either place them in a standard location, or control their location.

This section explains how to create them.


Create a Logic class

Follow the guidelines in the sub-sections below

Package Name

We recommend using name of your DomainClass, but replace the last node of the package name with businesslogic, for example:

  • database.buslogicintro.businesslogic contains the Business Logic Components for
  • database.buslogicintro.data Domain Objects

Class Name

We recommend using the default name: <DomainObjectName>Logic, for example

  • PurchaseorderLogic is the Business Logic Component for
  • PurchaseorderLogic Domain Object

Logic Class Content

Instance Variables

Create Instance Variables for the current/old Domain Object instances. These will be initialized by the Business Logic Engine prior to calling your Business Logic Rule methods

  1. Create these with the tags shown
  2. The annotations are required
    • @CurrentBean
    • @OldBean
  3. We recommend the (rather obvious) names of <DomainObjectName> and <DomainObjectName>_old
  4. The Object Type must, of course, match your Domain Object

The old bean is optional. There is a slight performance penalty for initializing it if you don't need it.

Logic Methods for Business Logic Rules

Once you have created your Business Logic Component, build Logic Methods that declare your Business Logic Rules:

  1. Formula, and Parent Copy
  2. Sum
  3. Count
  4. Constraint, and Commit Constraint
  5. Action, and Commit Action

Other Methods

You can also build procedural methods - see Business Logic Components can invoke Java/Groovy Methods.



Unlike procedural programming where your methods are called explicitly, Business Logic Rule methods are invoked by Business Logic Runtime, in response to inserts/updates/deletes done by client applications. Important observations:

  1. You can set breakpoints in the Business Logic Rule methods
  2. But, such calls are not always made. The Business Logic Engine will not call a Formula if, for example, all its local attributes are unchanged.
  3. Business Logic Components can be invoked multiple times per transaction, on the same row.
    For example, saving n Lineitems for a Purchaseorder would execute your Business Logic Component n times. On call "i", the old values pertain to call "i-1".
Personal tools