001package com.avaje.ebean.event;
002
003import java.util.Set;
004
005/**
006 * Provides a base implementation of BeanPersistListener.
007 * <p>
008 * Objects extending this should override the methods then are interested in.
009 * The default inserted() updated() and deleted() methods return false and as such
010 * means other servers in the cluster are not notified.
011 * </p>
012 */
013public abstract class AbstractBeanPersistListener implements BeanPersistListener {
014
015  /**
016   * Notified that a bean has been inserted locally. Return true if you want the
017   * cluster to be notified of the event.
018   *
019   * @param bean The bean that was inserted.
020   */
021  @Override
022  public boolean inserted(Object bean) {
023    return false;
024  }
025
026  /**
027   * Notified that a bean has been updated locally. Return true if you want the
028   * cluster to be notified of the event.
029   *
030   * @param bean              The bean that was updated.
031   * @param updatedProperties The properties that were modified by this update.
032   */
033  @Override
034  public boolean updated(Object bean, Set<String> updatedProperties) {
035    return false;
036  }
037
038  /**
039   * Notified that a bean has been deleted locally. Return true if you want the
040   * cluster to be notified of the event.
041   *
042   * @param bean The bean that was deleted.
043   */
044  @Override
045  public boolean deleted(Object bean) {
046    return false;
047  }
048
049  /**
050   * Notify that a bean was inserted on another node of the cluster.
051   *
052   * @param id the id value of the inserted bean
053   */
054  @Override
055  public void remoteInsert(Object id) {
056    // do nothing
057  }
058
059  /**
060   * Notify that a bean was updated on another node of the cluster.
061   *
062   * @param id the id value of the updated bean.
063   */
064  @Override
065  public void remoteUpdate(Object id) {
066    // do nothing
067  }
068
069  /**
070   * Notify that a bean was deleted on another node of the cluster.
071   *
072   * @param id the id value of the deleted bean.
073   */
074  @Override
075  public void remoteDelete(Object id) {
076    // do nothing
077  }
078}