jACOB 2.7 API Documentation.

de.tif.jacob.core.data.event
Class DataTableRecordEventHandler

java.lang.Object
  extended by DataEventHandler
      extended by de.tif.jacob.core.data.event.DataTableRecordEventHandler

public abstract class DataTableRecordEventHandler
extends DataEventHandler

This class represents the abstract base class for all data table record event handlers. A data table record event handler has to be implemented to "hook" application-specific business logic to table aliases. Therefore, the following hook methods could be implemented:

  • afterNewAction(IDataTableRecord, IDataTransaction)
  • afterDeleteAction(IDataTableRecord, IDataTransaction)
  • beforeCommitAction(IDataTableRecord, IDataTransaction)
  • afterCommitAction(IDataTableRecord)

    The jACOB application server then executes those hook methods on data level whenever data records of the related table alias are modified.


    Field Summary
    static java.lang.String RCS_ID
              The internal revision control system id.
    static java.lang.String RCS_REV
              The internal revision control system id in short form.
     
    Constructor Summary
    DataTableRecordEventHandler()
               
     
    Method Summary
    abstract  void afterCommitAction(IDataTableRecord tableRecord)
              This hook method will be called immediately after a record modification has been pushed to the data source.
    abstract  void afterDeleteAction(IDataTableRecord tableRecord, IDataTransaction transaction)
              This hook method will be called immediately after a delete operation has been invoked on the given record instance.
    abstract  void afterNewAction(IDataTableRecord tableRecord, IDataTransaction transaction)
              This hook method will be called immediately after a new record instance has been created and initialized.
    abstract  void beforeCommitAction(IDataTableRecord tableRecord, IDataTransaction transaction)
              This hook method will be called immediately before a record modification will be pushed to the data source.
    static DataTableRecordEventHandler get(IDataTable table)
              Internal method for fetching an event handler by means of the given data table.
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    RCS_ID

    public static final transient java.lang.String RCS_ID
    The internal revision control system id.

    See Also:
    Constant Field Values

    RCS_REV

    public static final transient java.lang.String RCS_REV
    The internal revision control system id in short form.

    See Also:
    Constant Field Values
    Constructor Detail

    DataTableRecordEventHandler

    public DataTableRecordEventHandler()
    Method Detail

    afterNewAction

    public abstract void afterNewAction(IDataTableRecord tableRecord,
                                        IDataTransaction transaction)
                                 throws java.lang.Exception
    This hook method will be called immediately after a new record instance has been created and initialized. This hook method is the right place to carry out further application specific initializations before the record will be displayed on the user screen.

    Attention: The record has not been committed to the data source!

    Parameters:
    tableRecord - the table record
    transaction - the transaction in which context this method is called
    Throws:
    java.lang.Exception - on any error, exception will be handed over to the caller
    See Also:
    IDataTable.newRecord(IDataTransaction), IDataAccessor.cloneRecord(IDataTransaction, IDataTableRecord), IDataAccessor.cloneRecord(IDataTransaction, IDataTableRecord, ITableAlias), IDataAccessor.cloneRecord(IDataTransaction, IDataTableRecord, String)

    afterDeleteAction

    public abstract void afterDeleteAction(IDataTableRecord tableRecord,
                                           IDataTransaction transaction)
                                    throws java.lang.Exception
    This hook method will be called immediately after a delete operation has been invoked on the given record instance. This hook method is the right place to carry out further application specific clear up actions.

    Attention: The record deletion has not been pushed to the data source!

    Parameters:
    tableRecord - the table record
    transaction - the transaction in which context this method is called
    Throws:
    java.lang.Exception - on any error, exception will be handed over to the caller
    See Also:
    IDataTableRecord.delete(IDataTransaction), IDataTable.searchAndDelete(IDataTransaction), IDataTable.fastDelete(IDataTransaction)

    beforeCommitAction

    public abstract void beforeCommitAction(IDataTableRecord tableRecord,
                                            IDataTransaction transaction)
                                     throws java.lang.Exception
    This hook method will be called immediately before a record modification will be pushed to the data source. A record modification might be either an insert, update or delete action!

    This hook method is the right place to carry out further application specific actions within the same transactional context and is especially useful to implement extended data consistency checks which are not handled by the underlying database. This is done by means of throwing an exception (in most cases this will be a UserException), if such a consistency check fails.

    Attention: This hook method does not have a recursive behaviour, i.e. neither beforeCommitAction(IDataTableRecord, IDataTransaction) nor afterCommitAction(IDataTableRecord) hook methods will be called for data records being additionally created or manipulated within this method. Nevertheless, this is the case for afterNewAction(IDataTableRecord, IDataTransaction) and afterDeleteAction(IDataTableRecord, IDataTransaction)!

    Parameters:
    tableRecord - the table record
    transaction - the transaction in which context this method is called
    Throws:
    java.lang.Exception - on any error, exception will be handed over to the caller
    See Also:
    IDataTransaction.commit()

    afterCommitAction

    public abstract void afterCommitAction(IDataTableRecord tableRecord)
                                    throws java.lang.Exception
    This hook method will be called immediately after a record modification has been pushed to the data source. A record modification might be either an insert, update or delete action!

    This hook method could be used to carry out further application actions within a separate transactional context.

    Parameters:
    tableRecord - the table record
    Throws:
    java.lang.Exception - on any error, exception will NOT be handed over to the caller but a log entry will be written.
    See Also:
    IDataTransaction.commit()

    get

    public static final DataTableRecordEventHandler get(IDataTable table)
                                                 throws java.lang.Exception
    Internal method for fetching an event handler by means of the given data table.

    Parameters:
    table - the data table to fetch the event handler for
    Returns:
    the resulting event handler, i.e. if no explicit table record event handler exists, a default handler would be returned.
    Throws:
    java.lang.Exception - a severe problem has occurred

    jACOB 2.7 API Documentation.