All Downloads are FREE. Search and download functionalities are using the official Maven repository.

play.modules.ebean.EbeanModelAdapter Maven / Gradle / Ivy

package play.modules.ebean;

import java.util.Set;

import com.avaje.ebean.event.BeanPersistAdapter;
import com.avaje.ebean.event.BeanPersistRequest;

public class EbeanModelAdapter extends BeanPersistAdapter
{

  @Override
  public boolean isRegisterFor(Class cls)
  {
    return EbeanSupport.class.isAssignableFrom(cls);
  }

  @Override
  public void postLoad(Object bean, Set includedProperties)
  {
    ((EbeanSupport) bean).afterLoad();
  }

  @Override
  public boolean preInsert(BeanPersistRequest request)
  {
    ((EbeanSupport) request.getBean()).beforeSave(true);
    return true;
  }

  @Override
  public boolean preUpdate(BeanPersistRequest request)
  {
    ((EbeanSupport) request.getBean()).beforeSave(false);
    return true;
  }

  @Override
  public void postInsert(BeanPersistRequest request)
  {
    ((EbeanSupport) request.getBean()).afterSave(true);
  }

  @Override
  public void postUpdate(BeanPersistRequest request)
  {
    ((EbeanSupport) request.getBean()).afterSave(false);
  }
  
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy