/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Other licenses:
 * -----------------------------------------------------------------------------
 * Commercial licenses for this work are available. These replace the above
 * ASL 2.0 and offer limited warranties, support, maintenance, and commercial
 * database integrations.
 *
 * For more information, please visit: http://www.jooq.org/licenses
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */
package org.jooq;

import java.util.EventListener;

A listener for manipulation events on UpdatableRecords.

Users may want to centrally inject custom behaviour when manipulating their UpdatableRecord objects, performing CRUD. This service provider allows to hook in callback method implementations for before or after any of these methods:

Author:Lukas Eder
/** * A listener for manipulation events on {@link UpdatableRecord}s. * <p> * Users may want to centrally inject custom behaviour when manipulating their * {@link UpdatableRecord} objects, performing CRUD. This service provider * allows to hook in callback method implementations for before or after any of * these methods: * <ul> * <li>{@link UpdatableRecord#store()}</li> * <li>{@link UpdatableRecord#insert()}</li> * <li>{@link UpdatableRecord#update()}</li> * <li>{@link UpdatableRecord#delete()}</li> * <li>{@link UpdatableRecord#refresh()}</li> * </ul> * * @author Lukas Eder */
public interface RecordListener extends EventListener {
Called before storing an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() prior to storing. Note that modifying the record's primary key value may influence whether storing results in an INSERT or UPDATE statement.

A store event will generate a nested insertStart(RecordContext) or updateStart(RecordContext) event.

See Also:
/** * Called before storing an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * prior to storing. Note that modifying the record's primary key value may * influence whether storing results in an <code>INSERT</code> or * <code>UPDATE</code> statement. * <p> * A store event will generate a nested {@link #insertStart(RecordContext)} * or {@link #updateStart(RecordContext)} event. * * @see UpdatableRecord#store() */
void storeStart(RecordContext ctx);
Called after storing an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() after storing. Note that modifying the record's primary key value may influence whether storing results in an INSERT or UPDATE statement.

A store event will generate a nested insertEnd(RecordContext) or updateEnd(RecordContext) event.

See Also:
/** * Called after storing an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * after storing. Note that modifying the record's primary key value may * influence whether storing results in an <code>INSERT</code> or * <code>UPDATE</code> statement. * <p> * A store event will generate a nested {@link #insertEnd(RecordContext)} * or {@link #updateEnd(RecordContext)} event. * * @see UpdatableRecord#store() */
void storeEnd(RecordContext ctx);
Called before inserting an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() prior to inserting.

See Also:
/** * Called before inserting an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * prior to inserting. * * @see UpdatableRecord#insert() */
void insertStart(RecordContext ctx);
Called after inserting an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() after inserting.

See Also:
/** * Called after inserting an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * after inserting. * * @see UpdatableRecord#insert() */
void insertEnd(RecordContext ctx);
Called before updating an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() prior to updating.

See Also:
/** * Called before updating an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * prior to updating. * * @see UpdatableRecord#update() */
void updateStart(RecordContext ctx);
Called after updating an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() after updating.

See Also:
/** * Called after updating an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * after updating. * * @see UpdatableRecord#update() */
void updateEnd(RecordContext ctx);
Called before merging an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() prior to merging.

See Also:
/** * Called before merging an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * prior to merging. * * @see UpdatableRecord#merge() */
void mergeStart(RecordContext ctx);
Called after merging an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() after merging.

See Also:
/** * Called after merging an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * after merging. * * @see UpdatableRecord#merge() */
void mergeEnd(RecordContext ctx);
Called before deleting an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() prior to deleting.

See Also:
/** * Called before deleting an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * prior to deleting. * * @see UpdatableRecord#delete() */
void deleteStart(RecordContext ctx);
Called after deleting an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() after deleting.

See Also:
/** * Called after deleting an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * after deleting. * * @see UpdatableRecord#delete() */
void deleteEnd(RecordContext ctx);
Called before loading an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() prior to loading.

/** * Called before loading an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * prior to loading. */
void loadStart(RecordContext ctx);
Called after loading an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() after loading.

/** * Called after loading an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * after loading. */
void loadEnd(RecordContext ctx);
Called before refreshing an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() prior to refreshing.

See Also:
/** * Called before refreshing an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * prior to refreshing. * * @see UpdatableRecord#refresh() */
void refreshStart(RecordContext ctx);
Called after refreshing an UpdatableRecord.

Implementations are allowed to modify RecordContext.record() after refreshing.

See Also:
/** * Called after refreshing an <code>UpdatableRecord</code>. * <p> * Implementations are allowed to modify {@link RecordContext#record()} * after refreshing. * * @see UpdatableRecord#refresh() */
void refreshEnd(RecordContext ctx);
Called when an exception occurs.
/** * Called when an exception occurs. */
void exception(RecordContext ctx); }