Reference‎ > ‎

Rules: Commit Action

A Commit Action rule is defined by a method with the @CommitAction annotation:

import com.autobizlogic.abl.businesslogic.annotations.*;

public class CustomerLogic {

    @CurrentBean
    private Customer customer;
    
    @CommitAction
    public void myAction() {
        if (customer.getBalance() > 1000)
           etc...
    }

This annotation has only one (optional) parameter verbs, which specifies the verb(s) under which this constraint should execute. It can specify any combination of INSERT, UPDATE or DELETE. If specified, theaction  will only execute in those conditions. If not specified, the action will always execute.

A Commit Action is invoked any time an object is touched (inserted, modified or deleted), but, unlike an Action, it is only invoked once, at the very end of the transaction processing.

As a result, a Commit Action is not allowed to modify any persistent data (at least nothing that might activate additional business logic).

The name of the method does not matter, but the method must be declared public.

Comments