/** * Invokes callbacks for a collection of entity objects. */ void performCallbacks(Collection<?> objects) { for (Object object : objects) { performCallbacks((Persistent) object); } }
/** * Invokes callbacks of a specific type for a given entity object. */ public void performCallbacks(LifecycleEvent type, Persistent object) { eventCallbacks[type.ordinal()].performCallbacks(object); }
/** * Invokes callbacks of a specific type for a collection of entity objects. */ public void performCallbacks(LifecycleEvent type, Collection<?> objects) { eventCallbacks[type.ordinal()].performCallbacks(objects); }
/** * Invokes callbacks for the class hierarchy, starting from the most generic * superclass. */ private void performCallbacks(Persistent object, Class<?> callbackEntityClass) { if (callbackEntityClass == null || Object.class.equals(callbackEntityClass)) { return; } // recursively perform super callbacks first if (!excludingSuperclassListeners(object.getObjectId().getEntityName())) { performCallbacks(object, callbackEntityClass.getSuperclass()); } // perform callbacks on provided class String key = callbackEntityClass.getName(); Collection<AbstractCallback> entityListeners = listeners.get(key); if (entityListeners != null) { for (final AbstractCallback listener : entityListeners) { listener.performCallback(object); } } }
/** * Invokes callbacks for a given entity object. */ void performCallbacks(Persistent object) { if(object == null) { // this can happen if object resolved to null from some query with outer join // (e.g. in EJBQL or SQLTemplate) return; } // default listeners are invoked first if (!defaultListeners.isEmpty() && !excludingDefaultListeners(object.getObjectId().getEntityName())) { for (AbstractCallback listener : defaultListeners) { listener.performCallback(object); } } // apply per-entity listeners performCallbacks(object, object.getClass()); }