butler.ext.log
Class UsernameListener

java.lang.Object
  extended by butler.sql.record.RecordListener.BaseImpl
      extended by butler.ext.log.UsernameListener
All Implemented Interfaces:
RecordListener

public class UsernameListener
extends RecordListener.BaseImpl

Record listener that ensure that a username column is updated with the current user when the record is saved.

Author:
Fredrik Bertilsson

Nested Class Summary
 
Nested classes/interfaces inherited from interface butler.sql.record.RecordListener
RecordListener.BaseImpl
 
Constructor Summary
UsernameListener(Column col, UsernameCallback callback)
           
UsernameListener(Column col, UsernameCallback callback, boolean onlyInsert)
           
 
Method Summary
 void beforeInsert(Record rec)
           
 void beforeUpdate(Record rec)
           
 void init(Record rec)
           
 
Methods inherited from class butler.sql.record.RecordListener.BaseImpl
afterDelete, afterInsert, afterSet, afterUpdate, beforeDelete, beforeSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UsernameListener

public UsernameListener(Column col,
                        UsernameCallback callback)

UsernameListener

public UsernameListener(Column col,
                        UsernameCallback callback,
                        boolean onlyInsert)
Method Detail

init

public void init(Record rec)
          throws java.lang.Exception
Specified by:
init in interface RecordListener
Overrides:
init in class RecordListener.BaseImpl
Throws:
java.lang.Exception

beforeUpdate

public void beforeUpdate(Record rec)
                  throws java.lang.Exception
Specified by:
beforeUpdate in interface RecordListener
Overrides:
beforeUpdate in class RecordListener.BaseImpl
Throws:
java.lang.Exception

beforeInsert

public void beforeInsert(Record rec)
                  throws java.lang.Exception
Specified by:
beforeInsert in interface RecordListener
Overrides:
beforeInsert in class RecordListener.BaseImpl
Throws:
java.lang.Exception