diff --git a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/EntityInterceptorListener.java b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/EntityInterceptorListener.java index 1e9c39237..c3a4e6552 100644 --- a/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/EntityInterceptorListener.java +++ b/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/model/EntityInterceptorListener.java @@ -27,43 +27,84 @@ import org.eclipse.hawkbit.repository.model.EntityInterceptor; */ public class EntityInterceptorListener { + /** + * Callback for lifecyle event pre persist. + * + * @param entity + * the JPA entity which this listener is associated with + */ @PrePersist - protected void prePersist(final Object entity) { + public void prePersist(final Object entity) { notifyAll(interceptor -> interceptor.prePersist(entity)); } + /** + * Callback for lifecyle event post persist. + * + * @param entity + * the JPA entity which this listener is associated with + */ @PostPersist - protected void postPersist(final Object entity) { + public void postPersist(final Object entity) { notifyAll(interceptor -> interceptor.postPersist(entity)); } + /** + * Callback for lifecyle event post remove. + * + * @param entity + * the JPA entity which this listener is associated with + */ @PostRemove - protected void postRemove(final Object entity) { + public void postRemove(final Object entity) { notifyAll(interceptor -> interceptor.postRemove(entity)); } + /** + * Callback for lifecyle event pre remove. + * + * @param entity + * the JPA entity which this listener is associated with + */ @PreRemove - protected void preRemove(final Object entity) { + public void preRemove(final Object entity) { notifyAll(interceptor -> interceptor.preRemove(entity)); } + /** + * Callback for lifecyle event post load. + * + * @param entity + * the JPA entity which this listener is associated with + */ @PostLoad - protected void postLoad(final Object entity) { + public void postLoad(final Object entity) { notifyAll(interceptor -> interceptor.postLoad(entity)); } + /** + * Callback for lifecyle event pre update. + * + * @param entity + * the JPA entity which this listener is associated with + */ @PreUpdate - protected void preUpdate(final Object entity) { + public void preUpdate(final Object entity) { notifyAll(interceptor -> interceptor.preUpdate(entity)); } + /** + * Callback for lifecyle event post update. + * + * @param entity + * the JPA entity which this listener is associated with + */ @PostUpdate - protected void postUpdate(final Object entity) { + public void postUpdate(final Object entity) { notifyAll(interceptor -> interceptor.postUpdate(entity)); } private void notifyAll(final Consumer action) { EntityInterceptorHolder.getInstance().getEntityInterceptors().forEach(action); } - }