public class OmeroInterceptor extends SqlQueryInterceptor
Interceptor for controlling various aspects
of the Hibernate runtime. Where no special requirements exist, methods
delegate to EmptyInterceptor
Current responsibilities include the proper (re-)setting of DetailsEmptyInterceptor,
SqlQueryInterceptor,
Interceptor,
Serialized Form| Constructor and Description |
|---|
OmeroInterceptor(ome.system.Roles roles,
SystemTypes sysTypes,
ExtendedMetadata em,
CurrentDetails cd,
TokenHolder tokenHolder,
SessionStats stats,
LightAdminPrivileges adminPrivileges,
ome.util.SqlAction sqlAction,
SqlQueryTransformer sqlQueryTransformer,
java.util.Set<java.lang.String> managedRepoUuids,
java.util.Set<java.lang.String> scriptRepoUuids) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterTransactionBegin(org.hibernate.Transaction tx) |
void |
afterTransactionCompletion(org.hibernate.Transaction tx) |
void |
beforeTransactionCompletion(org.hibernate.Transaction tx) |
ome.model.internal.Details |
checkManagedDetails(ome.model.IObject iobj,
ome.model.internal.Details previousDetails) |
protected ome.model.internal.Details |
checkManagedDetails(ome.model.IObject iobj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details newDetails)
Like
checkManagedDetails(IObject, Details, Details) but allows
passing in a specific Details instance. |
ome.model.internal.Details |
evaluateLinkages(ome.model.IObject changedObject)
Checks the details of the objects which the given object links to in
order to guarantee that linkages are valid.
|
int[] |
findDirty(java.lang.Object entity,
java.io.Serializable id,
java.lang.Object[] currentState,
java.lang.Object[] previousState,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
default logic
|
java.lang.Object |
getEntity(java.lang.String entityName,
java.io.Serializable id) |
java.lang.String |
getEntityName(java.lang.Object object) |
java.lang.Object |
instantiate(java.lang.String entityName,
org.hibernate.EntityMode entityMode,
java.io.Serializable id)
default logic, but we may want to use them eventually for
dependency-injection.
|
java.lang.Boolean |
isTransient(java.lang.Object entity) |
protected void |
log(java.lang.String msg) |
protected boolean |
managedEvent(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails) |
protected boolean |
managedExternalInfo(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails)
Deprecated.
|
protected boolean |
managedGroup(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails,
BasicEventContext bec) |
protected boolean |
managedOwner(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails,
BasicEventContext bec) |
protected ome.model.internal.Permissions.Right |
neededRight(java.lang.Class<?> changedClass,
java.lang.Class<?> linkedClass)
The default right need for a linkage is
Permissions.Right.WRITE. |
ome.model.internal.Details |
newTransientDetails(ome.model.IObject obj) |
protected ome.model.internal.Details |
newTransientDetails(ome.model.IObject obj,
ome.model.internal.Details newDetails)
Like
newTransientDetails(IObject) but allows passing in a
newDetails object with possibly preset values. |
void |
onCollectionRecreate(java.lang.Object collection,
java.io.Serializable key) |
void |
onCollectionRemove(java.lang.Object collection,
java.io.Serializable key) |
void |
onCollectionUpdate(java.lang.Object collection,
java.io.Serializable key) |
void |
onDelete(java.lang.Object entity,
java.io.Serializable id,
java.lang.Object[] state,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
default logic
|
boolean |
onFlushDirty(java.lang.Object entity,
java.io.Serializable id,
java.lang.Object[] currentState,
java.lang.Object[] previousState,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
calls back to
BasicSecuritySystem.checkManagedDetails(IObject, Details) for
properly setting Details. |
boolean |
onLoad(java.lang.Object entity,
java.io.Serializable id,
java.lang.Object[] state,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
default logic.
|
java.lang.String |
onPrepareStatement(java.lang.String sql) |
boolean |
onSave(java.lang.Object entity,
java.io.Serializable id,
java.lang.Object[] state,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
calls back to
BasicSecuritySystem.newTransientDetails(IObject) for
properly setting Details |
void |
postFlush(java.util.Iterator entities) |
void |
preFlush(java.util.Iterator entities) |
protected boolean |
resetDetails(ome.model.IObject entity,
java.lang.Object[] currentState,
java.lang.Object[] previousState,
int idx,
ome.model.internal.Details newDetails)
asks
BasicSecuritySystem to create a new managed Details
based on the previous state of this entity. |
public OmeroInterceptor(ome.system.Roles roles,
SystemTypes sysTypes,
ExtendedMetadata em,
CurrentDetails cd,
TokenHolder tokenHolder,
SessionStats stats,
LightAdminPrivileges adminPrivileges,
ome.util.SqlAction sqlAction,
SqlQueryTransformer sqlQueryTransformer,
java.util.Set<java.lang.String> managedRepoUuids,
java.util.Set<java.lang.String> scriptRepoUuids)
public java.lang.Object instantiate(java.lang.String entityName,
org.hibernate.EntityMode entityMode,
java.io.Serializable id)
throws org.hibernate.CallbackException
instantiate in interface org.hibernate.Interceptorinstantiate in class org.hibernate.EmptyInterceptororg.hibernate.CallbackExceptionpublic boolean onLoad(java.lang.Object entity,
java.io.Serializable id,
java.lang.Object[] state,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
throws org.hibernate.CallbackException
onLoad in interface org.hibernate.InterceptoronLoad in class org.hibernate.EmptyInterceptororg.hibernate.CallbackExceptionpublic int[] findDirty(java.lang.Object entity,
java.io.Serializable id,
java.lang.Object[] currentState,
java.lang.Object[] previousState,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
findDirty in interface org.hibernate.InterceptorfindDirty in class org.hibernate.EmptyInterceptorpublic boolean onSave(java.lang.Object entity,
java.io.Serializable id,
java.lang.Object[] state,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
BasicSecuritySystem.newTransientDetails(IObject) for
properly setting DetailsonSave in interface org.hibernate.InterceptoronSave in class org.hibernate.EmptyInterceptorpublic boolean onFlushDirty(java.lang.Object entity,
java.io.Serializable id,
java.lang.Object[] currentState,
java.lang.Object[] previousState,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
BasicSecuritySystem.checkManagedDetails(IObject, Details) for
properly setting Details.onFlushDirty in interface org.hibernate.InterceptoronFlushDirty in class org.hibernate.EmptyInterceptorpublic void onDelete(java.lang.Object entity,
java.io.Serializable id,
java.lang.Object[] state,
java.lang.String[] propertyNames,
org.hibernate.type.Type[] types)
throws org.hibernate.CallbackException
onDelete in interface org.hibernate.InterceptoronDelete in class org.hibernate.EmptyInterceptororg.hibernate.CallbackExceptionpublic void onCollectionRecreate(java.lang.Object collection,
java.io.Serializable key)
throws org.hibernate.CallbackException
onCollectionRecreate in interface org.hibernate.InterceptoronCollectionRecreate in class org.hibernate.EmptyInterceptororg.hibernate.CallbackExceptionpublic void onCollectionRemove(java.lang.Object collection,
java.io.Serializable key)
throws org.hibernate.CallbackException
onCollectionRemove in interface org.hibernate.InterceptoronCollectionRemove in class org.hibernate.EmptyInterceptororg.hibernate.CallbackExceptionpublic void onCollectionUpdate(java.lang.Object collection,
java.io.Serializable key)
throws org.hibernate.CallbackException
onCollectionUpdate in interface org.hibernate.InterceptoronCollectionUpdate in class org.hibernate.EmptyInterceptororg.hibernate.CallbackExceptionpublic void preFlush(java.util.Iterator entities)
throws org.hibernate.CallbackException
preFlush in interface org.hibernate.InterceptorpreFlush in class org.hibernate.EmptyInterceptororg.hibernate.CallbackExceptionpublic void postFlush(java.util.Iterator entities)
throws org.hibernate.CallbackException
postFlush in interface org.hibernate.InterceptorpostFlush in class org.hibernate.EmptyInterceptororg.hibernate.CallbackExceptionpublic void afterTransactionBegin(org.hibernate.Transaction tx)
afterTransactionBegin in interface org.hibernate.InterceptorafterTransactionBegin in class org.hibernate.EmptyInterceptorpublic void afterTransactionCompletion(org.hibernate.Transaction tx)
afterTransactionCompletion in interface org.hibernate.InterceptorafterTransactionCompletion in class org.hibernate.EmptyInterceptorpublic void beforeTransactionCompletion(org.hibernate.Transaction tx)
beforeTransactionCompletion in interface org.hibernate.InterceptorbeforeTransactionCompletion in class org.hibernate.EmptyInterceptorpublic java.lang.Object getEntity(java.lang.String entityName,
java.io.Serializable id)
throws org.hibernate.CallbackException
getEntity in interface org.hibernate.InterceptorgetEntity in class org.hibernate.EmptyInterceptororg.hibernate.CallbackExceptionpublic java.lang.String getEntityName(java.lang.Object object)
throws org.hibernate.CallbackException
getEntityName in interface org.hibernate.InterceptorgetEntityName in class org.hibernate.EmptyInterceptororg.hibernate.CallbackExceptionpublic java.lang.Boolean isTransient(java.lang.Object entity)
isTransient in interface org.hibernate.InterceptorisTransient in class org.hibernate.EmptyInterceptorpublic java.lang.String onPrepareStatement(java.lang.String sql)
onPrepareStatement in interface org.hibernate.InterceptoronPrepareStatement in class SqlQueryInterceptorprotected boolean resetDetails(ome.model.IObject entity,
java.lang.Object[] currentState,
java.lang.Object[] previousState,
int idx,
ome.model.internal.Details newDetails)
BasicSecuritySystem to create a new managed Details
based on the previous state of this entity. If the previous state is null
(see ticket:3929) then throw an exception.entity - IObject to be updatedcurrentState - the possibly changed field data for this entitypreviousState - the field data as seen in the dbidx - the index of Details in the state arrays.protected void log(java.lang.String msg)
public ome.model.internal.Details evaluateLinkages(ome.model.IObject changedObject)
save and
update since this is the only time that new entity references can be
created.changedObject - new or updated entity which may reference other entities which
then require locking. Nulls are tolerated but do nothing.protected ome.model.internal.Permissions.Right neededRight(java.lang.Class<?> changedClass,
java.lang.Class<?> linkedClass)
Permissions.Right.WRITE.
If however, this is only an annotation or only a viewing,
then less permission is needed.changedClass - the changed classlinkedClass - the linked classpublic ome.model.internal.Details newTransientDetails(ome.model.IObject obj)
protected ome.model.internal.Details newTransientDetails(ome.model.IObject obj,
ome.model.internal.Details newDetails)
newTransientDetails(IObject) but allows passing in a
newDetails object with possibly preset values.evaluateLinkages(IObject)public ome.model.internal.Details checkManagedDetails(ome.model.IObject iobj,
ome.model.internal.Details previousDetails)
protected ome.model.internal.Details checkManagedDetails(ome.model.IObject iobj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details newDetails)
checkManagedDetails(IObject, Details, Details) but allows
passing in a specific Details instance.@Deprecated
protected boolean managedExternalInfo(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails)
privileged - if the user is privilegedobj - the model objectpreviousDetails - details representing the known DB statecurrentDetails - details representing the user request (UNTRUSTED)newDetails - details from the current context. Holder for the merged
PermissionsPermissions of newDetails are changed.protected boolean managedOwner(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails,
BasicEventContext bec)
protected boolean managedGroup(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails,
BasicEventContext bec)
protected boolean managedEvent(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails)