Example usage for org.hibernate Interceptor getEntityName

List of usage examples for org.hibernate Interceptor getEntityName

Introduction

In this page you can find the example usage for org.hibernate Interceptor getEntityName.

Prototype

String getEntityName(Object object) throws CallbackException;

Source Link

Document

Get the entity name for a persistent or transient instance.

Usage

From source file:com.fiveamsolutions.nci.commons.util.CompositeInterceptorTest.java

License:Open Source License

private void helper(Interceptor i, boolean expectChanges) {
    i.afterTransactionBegin(null);/*ww  w.j  a  v  a2 s  . c om*/
    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:gov.nih.nci.cabig.ctms.audit.ChainedInterceptor.java

License:BSD License

public String getEntityName(Object object) {
    String result = null;/*from  w  w  w  . j  a va 2 s .c om*/
    for (Interceptor element : interceptors) {
        result = element.getEntityName(object);
        if (result != null) {
            /*
             * If any interceptor has returned something not null, stop the
             * chain
             */
            break;
        }
    }
    return result;
}

From source file:org.hyperic.hibernate.DefaultInterceptorChain.java

License:Open Source License

public String getEntityName(HibernateInterceptorChain chain, Interceptor target, Object object) {
    return target.getEntityName(object);
}

From source file:org.openmrs.api.db.hibernate.ChainingInterceptor.java

License:Mozilla Public License

public String getEntityName(Object object) {
    for (Interceptor i : interceptors) {
        String name = i.getEntityName(object);
        if (name != null) {
            return name;
        }//w  w w.j  a  v a 2  s  .com
    }

    return null;
}

From source file:org.riotfamily.common.hibernate.ChainedInterceptor.java

License:Apache License

public String getEntityName(Object object) throws CallbackException {
    for (Interceptor interceptor : interceptors) {
        String result = interceptor.getEntityName(object);
        if (result != null) {
            return result;
        }//from  w w w  . j  a  v  a2  s  .  c om
    }
    return null;
}