public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previuosState,String[] propertyNames, Type[] types) throws CallbackException { boolean bool = Boolean.FALSE; if(null!=interceptors && !interceptors.isEmpty()){ Iterator it = interceptors.iterator(); while(it.hasNext()){ Interceptor interceptor = (Interceptor) it.next(); boolean temp=false; if(interceptor!=null){ temp= interceptor.onFlushDirty(entity, id, currentState, previuosState, propertyNames, types); if(temp) bool = true; } } } return bool; }
@Override public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { boolean changed = false; for (PersistListener listener: listeners) { if (listener.onLoad(entity, id, state, propertyNames, types)) changed = true; } return changed; }
@Override public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException { boolean changed = false; for (PersistListener listener: listeners) { if (listener.onFlushDirty(entity, id, currentState, previousState, propertyNames, types)) changed = true; } return changed; }
@Override public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { boolean changed = false; for (PersistListener listener: listeners) { if (listener.onSave(entity, id, state, propertyNames, types)) changed = true; } return changed; }
@Override public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException { boolean modified = false; for (Interceptor interceptor : chain) { modified |= interceptor.onFlushDirty(entity, id, currentState, previousState, propertyNames, types); } return modified; }
@Override public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { boolean modified = false; for (Interceptor interceptor : chain) { modified |= interceptor.onSave(entity, id, state, propertyNames, types); } return modified; }
public boolean onLoad ( Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { return false; }
public boolean onFlushDirty(Object entity, Serializable id, Object[] newValues, Object[] oldValues, String[] propertyNames, Type[] types) throws CallbackException { if (entity instanceof Auditable) { getActionLogger().createLog( "update", entity, propertyNames, getUserId()); } return false; }
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { if (entity instanceof Auditable) { getActionLogger().createLog( "create", entity, propertyNames, getUserId()); } return false; }
public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { if (entity instanceof Auditable) { getActionLogger().createLog( "delete", entity, propertyNames, getUserId()); } }
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException { if (entity.getClass().isAnnotationPresent(Audit.class)) { updates.add(entity); } return false; }
@Override public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException { log.info( "Entity {0}#{1} changed from {2} to {3}", entity.getClass().getSimpleName(), id, Arrays.toString( previousState ), Arrays.toString( currentState ) ); return super.onFlushDirty(entity,id,currentState,previousState,propertyNames,types); }
public boolean onDelete(Session s) throws CallbackException { if (friends==null) return false; try { Iterator iter = friends.iterator(); while ( iter.hasNext() ) { s.delete( iter.next() ); } } catch (Exception e) { throw new CallbackException(e); } return false; }
public boolean onSave(Session s) throws CallbackException { if (friends==null) return false; try { Iterator iter = friends.iterator(); while ( iter.hasNext() ) { s.save( iter.next() ); } } catch (Exception e) { throw new CallbackException(e); } return false; }
public boolean onSave(Session session) throws CallbackException { created=true; try { foo = new Foo(); session.save(foo); } catch (Exception e) { throw new CallbackException(e); } foo.setString("child of a qux"); return NO_VETO; }
public boolean onDelete(Session session) throws CallbackException { deleted=true; try { session.delete(foo); } catch (Exception e) { throw new CallbackException(e); } //if (child!=null) session.delete(child); return NO_VETO; }
public boolean onSave(Session db) throws CallbackException { _string = "a string"; _date = new Date(123); _timestamp = new Date( System.currentTimeMillis() ); _integer = new Integer( -666 ); _long = new Long( 696969696969696969l - count++ ); _short = new Short("42"); _float = new Float( 6666.66f ); //_double = new Double( 1.33e-69 ); // this double is too big for the sap db jdbc driver _double = new Double( 1.12e-36 ); _boolean = new Boolean(true); _byte = new Byte( (byte) 127 ); _int = 2; _char = '@'; _bytes = _string.getBytes(); Struct s = new Struct(); s.name="name"; s.count = 69; blob = s; binary = ( _string + "yada yada yada" ).getBytes(); custom = new String[] { "foo", "bar" }; component = new FooComponent("foo", 12, new Date[] { _date, _timestamp, null, new Date() }, new FooComponent("bar", 666, new Date[] { new Date(123456l), null }, null ) ); component.setGlarch( new Glarch() ); dependent = new Fee(); dependent.setFi( "belongs to foo # " + getKey() ); theLocale = Locale.getDefault(); return NO_VETO; }
public boolean onSave(Session s) throws CallbackException { dynaBean = new HashMap(); dynaBean.put("foo", "foo"); dynaBean.put("bar", new Integer(66)); immutable="never changes!"; return NO_VETO; }
public boolean onFlushDirty( Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types ) throws CallbackException { if ( entity instanceof Document ) { currentState[3] = Calendar.getInstance(); return true; } else { return false; } }
public boolean onSave( Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types ) throws CallbackException { if ( entity instanceof Document ) { state[4] = state[3] = Calendar.getInstance(); return true; } else { return false; } }
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException { if ( entity instanceof Document ) { currentState[2] = Calendar.getInstance(); return true; } else { return false; } }
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { if ( entity instanceof Document ) { state[3] = state[2] = Calendar.getInstance(); return true; } else { return false; } }
@Override public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { Map<String, Object> changes = Maps.newHashMap(); changes.put("classicInterceptorSave", "interceptor"); updatePropertyValues(changes, propertyNames, state); return true; }
@Override public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException { Map<String, Object> changes = Maps.newHashMap(); changes.put("classicInterceptorFlushDirty", "interceptor"); updatePropertyValues(changes, propertyNames, currentState); return true; }
@Override public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException { if (entityName .equals("net.sf.odinms.server.maps.MapleReactorStats$StateData") && entityMode.equals(entityMode.POJO)) { return new MapleReactorStats.StateData(); } return null; }
@Override public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException { if (entityName.equals("MainPlayer") && entityMode.equals(EntityMode.POJO) && id.equals(this.id)) { return new MapleCharacter(client, this.id); } return null; }
@Override public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { boolean modified = false; for (Interceptor interceptor : interceptors) { modified = interceptor.onLoad(entity, id, state, propertyNames, types) || modified; } return modified; }
@Override public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException { boolean modified = false; for (Interceptor interceptor : interceptors) { modified = interceptor.onFlushDirty(entity, id, currentState, previousState, propertyNames, types) || modified; } return modified; }
@Override public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { boolean modified = false; for (Interceptor interceptor : interceptors) { modified = interceptor.onSave(entity, id, state, propertyNames, types) || modified; } return modified; }
@Override public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { for (PersistListener listener: listeners) listener.onDelete(entity, id, state, propertyNames, types); }
boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException;
boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
@Override public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException { for (Interceptor interceptor : chain) { interceptor.onDelete(entity, id, state, propertyNames, types); } }
@Override public void onCollectionRemove(Object collection, Serializable key) throws CallbackException { fail(); }
@Override public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException { fail(); }
@Override public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException { fail(); }
@Override public void onCollectionRemove(Object collection, Serializable key) throws CallbackException { Check.fail("The model session factory is not allowed to " + "update model data."); }