dbXML API

## com.dbxml.db.core.trigger
Class SimpleTrigger

    java.lang.Object
      com.dbxml.util.SimpleConfigurable
          com.dbxml.db.core.trigger.SimpleTrigger

All Implemented Interfaces:
  Configurable, Trigger

Direct Known Subclasses:
  ScriptTrigger, SyncTrigger

public class SimpleTrigger
extends SimpleConfigurable
implements Trigger

SimpleTrigger

Constructor Summary
`SimpleTrigger()`

Method Summary
`void` `afterDelete(Transaction tx, Key key, java.lang.Object oldObj)` afterDelete is fired after a Object is deleted from the Collection.
`void` `afterGet(Transaction tx, Key key, java.lang.Object obj)` afterGet is fired after a Object is retrieved from the Collection, but before it is actually returned.
`void` `afterInsert(Transaction tx, Key key, java.lang.Object newObj)` afterInsert is fired after a new Object is inserted into the Collection.
`void` `afterUpdate(Transaction tx, Key key, java.lang.Object oldObj, java.lang.Object newObj)` afterUpdate is fired after a Object is updated in the Collection.
`void` `beforeDelete(Transaction tx, Key key, java.lang.Object oldObj)` beforeDelete is fired before a Object is deleted from the Collection.
`void` `beforeGet(Transaction tx, Key key)` beforeGet is fired before a Object is retrieved from the Collection.
`java.lang.Object` `beforeInsert(Transaction tx, Key key, java.lang.Object newObj)` beforeInsert is fired before a new Object is inserted into the Collection.
`java.lang.Object` `beforeUpdate(Transaction tx, Key key, java.lang.Object oldObj, java.lang.Object newObj)` beforeUpdate is fired before a Object is updated in the Collection.
`Collection` `getCollection()` getCollection returns the Collection context for this Trigger.
`java.lang.String` `getName()` getName returns the name of this Trigger.
`void` `setCollection(Collection collection)` setCollection sets the Collection context for this Trigger.
`void` `setConfig(Configuration config)` setConfig sets the configuration information for the Configurable object instance.

Methods inherited from class com.dbxml.util.SimpleConfigurable
`getConfig`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.dbxml.util.Configurable
`getConfig`

Constructor Detail

### SimpleTrigger

    public SimpleTrigger()

Method Detail

### setCollection

    public void setCollection(Collection collection)

  Description copied from interface: `Trigger`
  setCollection sets the Collection context for this Trigger.

  Specified by:
    `setCollection` in interface `Trigger`
  Parameters:
    `collection` - The Collection

### getCollection

    public Collection getCollection()

  Description copied from interface: `Trigger`
  getCollection returns the Collection context for this Trigger.

  Specified by:
    `getCollection` in interface `Trigger`
  Returns:
    The Collection

### setConfig

    public void setConfig(Configuration config)
                   throws dbXMLException

  Description copied from interface: `Configurable`
  setConfig sets the configuration information for the Configurable object instance.

  Specified by:
    `setConfig` in interface `Configurable`
  Overrides:
    `setConfig` in class `SimpleConfigurable`
  Throws:
    `dbXMLException`

### getName

    public java.lang.String getName()

  Description copied from interface: `Trigger`
  getName returns the name of this Trigger.

  Specified by:
    `getName` in interface `Trigger`
  Returns:
    the Trigger name

### beforeInsert

    public java.lang.Object beforeInsert(Transaction tx,
                                         Key key,
                                         java.lang.Object newObj)
                                  throws DBException

  Description copied from interface: `Trigger`
  beforeInsert is fired before a new Object is inserted into the Collection. Throw a CancelOperationException to cancel the Object insertion.

  Specified by:
    `beforeInsert` in interface `Trigger`
  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
    `newObj` - The new Object
  Returns:
    The modified or original new Object
  Throws:
    `DBException`

### afterInsert

    public void afterInsert(Transaction tx,
                            Key key,
                            java.lang.Object newObj)
                     throws DBException

  Description copied from interface: `Trigger`
  afterInsert is fired after a new Object is inserted into the Collection.

  Specified by:
    `afterInsert` in interface `Trigger`
  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
    `newObj` - The new Object
  Throws:
    `DBException`

### beforeUpdate

    public java.lang.Object beforeUpdate(Transaction tx,
                                         Key key,
                                         java.lang.Object oldObj,
                                         java.lang.Object newObj)
                                  throws DBException

  Description copied from interface: `Trigger`
  beforeUpdate is fired before a Object is updated in the Collection. Throw a CancelOperationException to cancel the Object update.

  Specified by:
    `beforeUpdate` in interface `Trigger`
  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
    `oldObj` - The old Object
    `newObj` - The new Object
  Returns:
    The modified or original new Object
  Throws:
    `DBException`

### afterUpdate

    public void afterUpdate(Transaction tx,
                            Key key,
                            java.lang.Object oldObj,
                            java.lang.Object newObj)
                     throws DBException

  Description copied from interface: `Trigger`
  afterUpdate is fired after a Object is updated in the Collection.

  Specified by:
    `afterUpdate` in interface `Trigger`
  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
    `oldObj` - The old Object
    `newObj` - The new Object
  Throws:
    `DBException`

### beforeDelete

    public void beforeDelete(Transaction tx,
                             Key key,
                             java.lang.Object oldObj)
                      throws DBException

  Description copied from interface: `Trigger`
  beforeDelete is fired before a Object is deleted from the Collection. Throw a CancelOperationException to cancel the delete operation.

  Specified by:
    `beforeDelete` in interface `Trigger`
  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
    `oldObj` - The Object to be deleted
  Throws:
    `DBException`

### afterDelete

    public void afterDelete(Transaction tx,
                            Key key,
                            java.lang.Object oldObj)
                     throws DBException

  Description copied from interface: `Trigger`
  afterDelete is fired after a Object is deleted from the Collection.

  Specified by:
    `afterDelete` in interface `Trigger`
  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
    `oldObj` - The Object that was deleted
  Throws:
    `DBException`

### beforeGet

    public void beforeGet(Transaction tx,
                          Key key)
                   throws DBException

  Description copied from interface: `Trigger`
  beforeGet is fired before a Object is retrieved from the Collection. At this point, the Object hasn't even been loaded, so there is no reference to the actual Object Node.

  Specified by:
    `beforeGet` in interface `Trigger`
  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
  Throws:
    `DBException`

### afterGet

    public void afterGet(Transaction tx,
                         Key key,
                         java.lang.Object obj)
                  throws DBException

  Description copied from interface: `Trigger`
  afterGet is fired after a Object is retrieved from the Collection, but before it is actually returned.

  Specified by:
    `afterGet` in interface `Trigger`
  Parameters:
    `tx` - The controlling Transaction
    `key` - The Object Key
  Throws:
    `DBException`

dbXML API

Copyright (c) 2004 The dbXML Group