ca.odell.glazedlists.hibernate
Class EventListType

java.lang.Object
  extended by ca.odell.glazedlists.hibernate.EventListType
All Implemented Interfaces:
org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserCollectionType

public class EventListType
extends Object
implements org.hibernate.usertype.UserCollectionType, org.hibernate.usertype.ParameterizedType

A Hibernate custom collection type for mapping and persisting a BasicEventList with the help of a PersistentEventList.

To create the EventLists, an EventListFactory is used. The default factory simply instantiates new BasicEventLists with unshared ReadWriteLocks and ListEventPublishers. If that doesn't suite your needs, you can either implement and set your own EventListFactory implementation. Or you can use a so called list category. By setting a list category on the EventListType instance, a different list factory will be used which uses the category to determine the publisher and lock to use for all EventLists it creates. This way, all EventListType instances which use the same list category will produce EventLists with the same shared lock and publisher. The desired list category can be set programmatically by subclassing. When Hibernate bug HHH-2336 is fixed, you will be able to specify the category as collection type parameter in your Hibernate mapping file.

Author:
Bruce Alspaugh, Holger Brands
See Also:
setListFactory(EventListFactory), useListCategory(String), PROPERTYNAME_EVENTLIST_CATEGORY

Field Summary
static String PROPERTYNAME_EVENTLIST_CATEGORY
          Name of property for specifying an EventList category in the Hibernate mapping file.
 
Constructor Summary
EventListType()
           
 
Method Summary
 boolean contains(Object collection, Object entity)
          
 Iterator getElementsIterator(Object collection)
          
 EventListFactory getListFactory()
          Gets the used EventListFactory.
 Object indexOf(Object collection, Object obj)
          
 Object instantiate()
          Instantiate an empty instance of the "underlying" collection (not a wrapper).
 Object instantiate(int anticipatedSize)
          
 org.hibernate.collection.PersistentCollection instantiate(org.hibernate.engine.SessionImplementor session, org.hibernate.persister.collection.CollectionPersister persister)
          
 Object replaceElements(Object original, Object target, org.hibernate.persister.collection.CollectionPersister persister, Object owner, Map copyCache, org.hibernate.engine.SessionImplementor session)
          
 void setListFactory(EventListFactory newListFactory)
          Sets a new EventListFactory.
 void setParameterValues(Properties parameters)
          When Hibernate bug HHH-2336 is fixed, this method will be called by Hibernate when reading its mapping files.
protected  void useListCategory(String category)
          Convenience method to specify the used list category.
protected  void useListCategory(String category, ReadWriteLock lock, ListEventPublisher publisher)
          Convenience method to specify the used list category and the associated ReadWriteLock and ListEventPublisher
 org.hibernate.collection.PersistentCollection wrap(org.hibernate.engine.SessionImplementor session, Object collection)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTYNAME_EVENTLIST_CATEGORY

public static final String PROPERTYNAME_EVENTLIST_CATEGORY
Name of property for specifying an EventList category in the Hibernate mapping file.

See Also:
Constant Field Values
Constructor Detail

EventListType

public EventListType()
Method Detail

getListFactory

public final EventListFactory getListFactory()
Gets the used EventListFactory.


setListFactory

public final void setListFactory(EventListFactory newListFactory)
Sets a new EventListFactory.


setParameterValues

public final void setParameterValues(Properties parameters)
When Hibernate bug HHH-2336 is fixed, this method will be called by Hibernate when reading its mapping files.

Specified by:
setParameterValues in interface org.hibernate.usertype.ParameterizedType

useListCategory

protected final void useListCategory(String category)
Convenience method to specify the used list category.


useListCategory

protected final void useListCategory(String category,
                                     ReadWriteLock lock,
                                     ListEventPublisher publisher)
Convenience method to specify the used list category and the associated ReadWriteLock and ListEventPublisher


contains

public boolean contains(Object collection,
                        Object entity)

Specified by:
contains in interface org.hibernate.usertype.UserCollectionType

getElementsIterator

public Iterator getElementsIterator(Object collection)

Specified by:
getElementsIterator in interface org.hibernate.usertype.UserCollectionType

indexOf

public Object indexOf(Object collection,
                      Object obj)

Specified by:
indexOf in interface org.hibernate.usertype.UserCollectionType

instantiate

public Object instantiate()
Instantiate an empty instance of the "underlying" collection (not a wrapper). Kept for compatibility with older Hibernate versions.


instantiate

public Object instantiate(int anticipatedSize)

Specified by:
instantiate in interface org.hibernate.usertype.UserCollectionType

instantiate

public org.hibernate.collection.PersistentCollection instantiate(org.hibernate.engine.SessionImplementor session,
                                                                 org.hibernate.persister.collection.CollectionPersister persister)
                                                          throws org.hibernate.HibernateException

Specified by:
instantiate in interface org.hibernate.usertype.UserCollectionType
Throws:
org.hibernate.HibernateException

replaceElements

public Object replaceElements(Object original,
                              Object target,
                              org.hibernate.persister.collection.CollectionPersister persister,
                              Object owner,
                              Map copyCache,
                              org.hibernate.engine.SessionImplementor session)
                       throws org.hibernate.HibernateException

Specified by:
replaceElements in interface org.hibernate.usertype.UserCollectionType
Throws:
org.hibernate.HibernateException

wrap

public org.hibernate.collection.PersistentCollection wrap(org.hibernate.engine.SessionImplementor session,
                                                          Object collection)

Specified by:
wrap in interface org.hibernate.usertype.UserCollectionType


Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by mockbuild at 2013-02-07 9:25