List of usage examples for org.hibernate Interceptor onLoad
boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
From source file:com.fiveamsolutions.nci.commons.util.CompositeInterceptor.java
License:Open Source License
/** * Calls the children's onLoad methods, in order. * * @param entity entity//www.j a va2 s . c o m * @param id id * @param state state * @param propertyNames propertyNames * @param types types * * @return true if <em>any</em> child has modified the state in any way */ public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { boolean result = false; for (Interceptor i : children) { result |= i.onLoad(entity, id, state, propertyNames, types); } return result; }
From source file:com.fiveamsolutions.nci.commons.util.CompositeInterceptorTest.java
License:Open Source License
private void helper(Interceptor i, boolean expectChanges) { i.afterTransactionBegin(null);//from www . j ava 2s . c o m i.afterTransactionCompletion(null); i.beforeTransactionCompletion(null); assertNull(i.getEntity(null, null)); assertNull(i.getEntityName(null)); if (expectChanges) { assertNotNull(i.findDirty(null, null, null, null, null, null)); assertNotNull(i.instantiate(null, null, null)); assertNotNull(i.isTransient(null)); assertTrue(!"foo".equals(i.onPrepareStatement("foo"))); } else { assertNull(i.findDirty(null, null, null, null, null, null)); assertNull(i.instantiate(null, null, null)); assertNull(i.isTransient(null)); assertEquals("foo", i.onPrepareStatement("foo")); } i.onCollectionRecreate(null, null); i.onCollectionRemove(null, null); i.onCollectionUpdate(null, null); i.onDelete(null, null, null, null, null); assertEquals(expectChanges, i.onFlushDirty(null, null, null, null, null, null)); assertEquals(expectChanges, i.onLoad(null, null, null, null, null)); assertEquals(expectChanges, i.onSave(null, null, null, null, null)); i.postFlush(null); i.preFlush(null); }
From source file:debop4k.data.orm.hibernate.interceptors.MultipleInterceptor.java
License:Apache License
@Override public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { if (nonEmpty()) { for (Interceptor interceptor : interceptors) { interceptor.onLoad(entity, id, state, propertyNames, types); }//from ww w .j a v a 2s. c om } return false; }
From source file:gov.nih.nci.cabig.ctms.audit.ChainedInterceptor.java
License:BSD License
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { boolean result = false; for (Interceptor element : interceptors) { if (element.onLoad(entity, id, state, propertyNames, types)) { /*// w ww .ja va 2 s. c om * Returns true if one interceptor in the chain has modified the * object state result = true; */ } } return result; }
From source file:kr.debop4j.data.hibernate.interceptor.MultiInterceptor.java
License:Apache License
@Override public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { if (!isExists()) return false; if (isTraceEnabled) log.trace("?? onLoad ? ."); for (final Interceptor interceptor : interceptors) { interceptor.onLoad(entity, id, state, propertyNames, types); }//from ww w .j a v a 2 s. c om return false; }
From source file:org.chenillekit.hibernate.interceptors.ChainedInterceptor.java
License:Apache License
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { boolean result = false; for (Object o : interceptors.entrySet()) { Map.Entry entry = (Map.Entry) o; Interceptor interceptor = (Interceptor) entry.getValue(); if (interceptor.onLoad(entity, id, state, propertyNames, types)) result = true;/*from w w w . jav a 2 s. c o m*/ } return result; }
From source file:org.hyperic.hibernate.DefaultInterceptorChain.java
License:Open Source License
public boolean onLoad(HibernateInterceptorChain chain, Interceptor target, Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { return target.onLoad(entity, id, state, propertyNames, types); }
From source file:org.openmrs.api.db.hibernate.ChainingInterceptor.java
License:Mozilla Public License
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { boolean objectChanged = false; for (Interceptor i : interceptors) { // must be in this order so that java doesn't skip the method call for optimizations objectChanged = i.onLoad(entity, id, state, propertyNames, types) || objectChanged; }//from w ww . java2 s . c om return objectChanged; }
From source file:org.riotfamily.common.hibernate.ChainedInterceptor.java
License:Apache License
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { boolean result = false; for (Interceptor interceptor : interceptors) { result |= interceptor.onLoad(entity, id, state, propertyNames, types); }//from w w w. j a va 2 s . co m return result; }