Reference‎ > ‎

Rules: Action


An Action rule is defined by a method with the @Action annotation:

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

public class CustomerLogic {

    private Customer customer;
    public void myAction() {
        if (customer.getBalance() > 1000)

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, the action will execute only in those conditions. If not specified, the action will always execute.

The name of the method has no special meaning, but the method must be public, otherwise it cannot be invoked successfully.


An Action is invoked any time an object is touched (inserted, modified or deleted).

If an Action throws an exception, the current transaction will be rolled back.

There are no specific limitations on what can be done in an Action. Objects can be modified, created and deleted, and all changes will become part of the current transaction.

An Action may get invoked more than once within a transaction if the execution of the business logic dictates it.

Changing persistent objects

If an action affects persistent objects, it must do the following for each affected object:

The newly inserted object must be saved using LogicContext.insert(), and not e.g. Hibernate's

The object to be deleted must be passed to LogicContext.delete(), and not e.g. Hibernate's session.delete().

Any object that is to be updated must be bracketed between a call to LogicContext.touch() and a call to LogicContext.update().
The call to LogicContext.touch() must be made before any changes are made to the object's persistent state.


private PurchaseOrder order;

private LogicContext context;

public void myAction() {
    // Any update must be bracketed as follows
    order.setNotes("This is a test");

    // Inserts and deletes must be handled by the LogicContext
    LineItem item = new LineItem();