001package com.avaje.ebean.event;
002
003import com.avaje.ebean.config.ServerConfig;
004
005/**
006 * A no operation implementation of BeanPersistController. Objects extending
007 * this need to only override the methods they want to.
008 * <p>
009 * A BeanPersistAdapter is either found automatically via class path search or
010 * can be added programmatically via
011 * {@link ServerConfig#add(BeanPersistController)} or
012 * {@link ServerConfig#setPersistControllers(java.util.List)}.
013 * </p>
014 */
015public abstract class BeanPersistAdapter implements BeanPersistController {
016
017  public abstract boolean isRegisterFor(Class<?> cls);
018
019  /**
020   * Returns 10 - override this to control the order in which
021   * BeanPersistController's are executed when there is multiple of them
022   * registered for a given entity type (class).
023   */
024  public int getExecutionOrder() {
025    return 10;
026  }
027
028  /**
029   * Returns true indicating normal processing should continue.
030   */
031  public boolean preDelete(BeanPersistRequest<?> request) {
032    return true;
033  }
034
035  /**
036   * Returns true indicating normal processing should continue.
037   */
038  public boolean preInsert(BeanPersistRequest<?> request) {
039    return true;
040  }
041
042  /**
043   * Returns true indicating normal processing should continue.
044   */
045  public boolean preUpdate(BeanPersistRequest<?> request) {
046    return true;
047  }
048
049  /**
050   * Does nothing by default.
051   */
052  public void postDelete(BeanPersistRequest<?> request) {
053  }
054
055  /**
056   * Does nothing by default.
057   */
058  public void postInsert(BeanPersistRequest<?> request) {
059  }
060
061  /**
062   * Does nothing by default.
063   */
064  public void postUpdate(BeanPersistRequest<?> request) {
065  }
066
067}