ome.tools.hibernate
Class HibernateUtils

java.lang.Object
  extended by ome.tools.hibernate.HibernateUtils

public abstract class HibernateUtils
extends Object

contains methods for reloading unloaded entities and nulled collections as well as determining the index of certain properties in a dehydrated Hiberante array.

Since:
3.0-M3
Version:
$Revision: 6440 $, $Date: 2010-03-31 11:44:33 +0100 (Wed, 31 Mar 2010) $
Author:
Josh Moore, josh.moore at gmx.de
See Also:
wiki:ObjectModel

Constructor Summary
HibernateUtils()
           
 
Method Summary
protected static Collection copy(Collection c)
           
protected static Map copy(Map m)
           
static int detailsIndex(String[] propertyNames)
           
static void fixNulledOrFilteredCollections(ome.model.IObject entity, ome.model.IObject target, org.hibernate.persister.entity.EntityPersister persister, org.hibernate.engine.SessionImplementor source)
          loads collections which have been filtered or nulled by the user
static ome.model.internal.Details getDetails(Object[] state, String[] names)
           
static boolean idEqual(ome.model.IObject arg1, ome.model.IObject arg2)
          returns true under the following circumstatnces: both arguments are null, or both arguments are identical (==), or both arguments have the same id value(equals)
static int index(String str, String[] propertyNames)
           
static boolean isUnloaded(Object original)
           
static Long nullSafeGroupId(ome.model.IObject iobject)
          returns the id of the group of this entity, or null if: (1) the object is null, (2) the Details is null, (3) the group is null.
static Long nullSafeOwnerId(ome.model.IObject iobject)
          returns the id of the owner of this entity, or null if: (1) the object is null, (2) the Details is null, (3) the owner is null.
static boolean onlyPermissionsChanged(ome.model.internal.Details new_d, ome.model.internal.Details old_d)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateUtils

public HibernateUtils()
Method Detail

isUnloaded

public static boolean isUnloaded(Object original)

nullSafeOwnerId

public static Long nullSafeOwnerId(ome.model.IObject iobject)
returns the id of the owner of this entity, or null if: (1) the object is null, (2) the Details is null, (3) the owner is null.

Parameters:
iobject - Can be null.
Returns:
the id or null.

nullSafeGroupId

public static Long nullSafeGroupId(ome.model.IObject iobject)
returns the id of the group of this entity, or null if: (1) the object is null, (2) the Details is null, (3) the group is null.

Parameters:
iobject - Can be null.
Returns:
the id or null.

fixNulledOrFilteredCollections

public static void fixNulledOrFilteredCollections(ome.model.IObject entity,
                                                  ome.model.IObject target,
                                                  org.hibernate.persister.entity.EntityPersister persister,
                                                  org.hibernate.engine.SessionImplementor source)
loads collections which have been filtered or nulled by the user

Parameters:
entity - IObject to have its collections reloaded
id - persistent (db) id of this entity
currentState - the possibly changed field data for this entity
previousState - the field data as seen in the db
propertyNames - field names
types - Hibernate Type for each field
detailsIndex - the index of the Details instance (perf opt)

onlyPermissionsChanged

public static boolean onlyPermissionsChanged(ome.model.internal.Details new_d,
                                             ome.model.internal.Details old_d)
Parameters:
newD - Not null.
oldD - Not null.
Returns:

idEqual

public static boolean idEqual(ome.model.IObject arg1,
                              ome.model.IObject arg2)
returns true under the following circumstatnces:


getDetails

public static ome.model.internal.Details getDetails(Object[] state,
                                                    String[] names)

detailsIndex

public static int detailsIndex(String[] propertyNames)

index

public static int index(String str,
                        String[] propertyNames)

copy

protected static Map copy(Map m)

copy

protected static Collection copy(Collection c)


OmeroJava Api

Version: Beta-4.2.0-r7571-b29

Copyright © 2009 The University of Dundee. All Rights Reserved.