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