com.taggercat.model
Class TCPersistentSet

java.lang.Object
  extended by org.hibernate.collection.AbstractPersistentCollection
      extended by org.hibernate.collection.PersistentSet
          extended by com.taggercat.model.TCPersistentSet
All Implemented Interfaces:
IResultSetCollection, java.io.Serializable, java.lang.Iterable, java.util.Collection, java.util.Set, org.hibernate.collection.PersistentCollection

public class TCPersistentSet
extends org.hibernate.collection.PersistentSet
implements java.util.Set, IResultSetCollection

A persistent wrapper for a java.util.Set. The underlying collection is always LinkedHashSet; since we always want to deal with an ordered collection. This class also keeps a List of entities in Set. This allows us to implement the IResultSetCollection interface in a reasonable manner. In other words, we need both ordered sets, and indexed access.

See Also:
Serialized Form
 

Constructor Summary
TCPersistentSet()
          Empty constructor.
TCPersistentSet(org.hibernate.engine.SessionImplementor session)
          Constructor matching super.
TCPersistentSet(org.hibernate.engine.SessionImplementor session, java.lang.Object owner, java.util.Set<?> set, java.lang.String roleName, java.io.Serializable loadedKey, boolean isMutable)
           
TCPersistentSet(org.hibernate.engine.SessionImplementor session, java.util.Set set)
          Instantiates a non-lazy set (the underlying set is constructed from the incoming set reference).
 
Method Summary
 boolean add(java.lang.Object value)
           
 boolean addAll(java.util.Collection coll)
           
 void beforeInitialize(org.hibernate.persister.collection.CollectionPersister persister, int anticipatedSize)
           
 void beginRead()
           
 void clear()
           
 void delete()
           
 boolean endRead()
           
 boolean equals(java.lang.Object other)
           
 TCEntity getCurrentEntity()
           
 int getCurrentNdx()
           
 TCEntity getEntityAt(int rowIndex)
           
 TCEntity getEntityByPKHexCode(java.lang.String pkHexCode)
          Gets the row in the collection by its PKHexCode.
 TCEntity getFirst()
           
 TCEntity getLast()
           
 TCEntity getNext()
           
 TCEntity getNextNth(int n)
           
 TCEntity getPrevious()
           
 int getRowCount()
           
 int hashCode()
           
 void initializeFromCache(org.hibernate.persister.collection.CollectionPersister persister, java.io.Serializable disassembled, java.lang.Object owner)
           
 void insertAtCurrentNdx(TCEntity obj)
           
 boolean isAtBeginning()
           
 boolean isAtEnd()
           
 boolean remove(java.lang.Object value)
           
 boolean removeAll(java.util.Collection coll)
           
 boolean retainAll(java.util.Collection coll)
           
 void setCurrentNdx(int currentNdx)
           
 
Methods inherited from class org.hibernate.collection.PersistentSet
contains, containsAll, disassemble, empty, entries, entryExists, equalsSnapshot, getDeletes, getElement, getIndex, getOrphans, getSnapshot, getSnapshotElement, isEmpty, isRowUpdatePossible, isSnapshotEmpty, isWrapper, iterator, needsInserting, needsUpdating, readFrom, size, toArray, toArray, toString
 
Methods inherited from class org.hibernate.collection.AbstractPersistentCollection
afterInitialize, afterRowInsert, clearDirty, dirty, forceInitialization, getIdentifier, getKey, getOwner, getQueuedOrphans, getRole, getSession, getStoredSnapshot, getValue, hasQueuedOperations, isDirectlyAccessible, isDirty, isUnreferenced, needsRecreate, postAction, preInsert, queuedAdditionIterator, setCurrentSession, setOwner, setSnapshot, unsetSession, wasInitialized
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
contains, containsAll, isEmpty, iterator, size, toArray, toArray
 

Constructor Detail

TCPersistentSet

public TCPersistentSet()
Empty constructor.

Note: this form is not ever ever ever used by Hibernate; it is, however, needed for SOAP libraries and other such marshalling code.


TCPersistentSet

public TCPersistentSet(org.hibernate.engine.SessionImplementor session)
Constructor matching super. Instantiates a lazy set (the underlying set is un-initialized).

Parameters:
session - The session to which this set will belong.

TCPersistentSet

public TCPersistentSet(org.hibernate.engine.SessionImplementor session,
                       java.util.Set set)
Instantiates a non-lazy set (the underlying set is constructed from the incoming set reference).

Parameters:
session - The session to which this set will belong.
set - The underlying set data.

TCPersistentSet

public TCPersistentSet(org.hibernate.engine.SessionImplementor session,
                       java.lang.Object owner,
                       java.util.Set<?> set,
                       java.lang.String roleName,
                       java.io.Serializable loadedKey,
                       boolean isMutable)
Method Detail

beforeInitialize

public void beforeInitialize(org.hibernate.persister.collection.CollectionPersister persister,
                             int anticipatedSize)
Specified by:
beforeInitialize in interface org.hibernate.collection.PersistentCollection
Overrides:
beforeInitialize in class org.hibernate.collection.PersistentSet

initializeFromCache

public void initializeFromCache(org.hibernate.persister.collection.CollectionPersister persister,
                                java.io.Serializable disassembled,
                                java.lang.Object owner)
                         throws org.hibernate.HibernateException
Specified by:
initializeFromCache in interface org.hibernate.collection.PersistentCollection
Overrides:
initializeFromCache in class org.hibernate.collection.PersistentSet
Throws:
org.hibernate.HibernateException

add

public boolean add(java.lang.Object value)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Overrides:
add in class org.hibernate.collection.PersistentSet
See Also:
Set.add(Object)

remove

public boolean remove(java.lang.Object value)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.Set
Overrides:
remove in class org.hibernate.collection.PersistentSet
See Also:
Set.remove(Object)

addAll

public boolean addAll(java.util.Collection coll)
Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.Set
Overrides:
addAll in class org.hibernate.collection.PersistentSet
See Also:
Set.addAll(Collection)

retainAll

public boolean retainAll(java.util.Collection coll)
Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.Set
Overrides:
retainAll in class org.hibernate.collection.PersistentSet
See Also:
Set.retainAll(Collection)

removeAll

public boolean removeAll(java.util.Collection coll)
Specified by:
removeAll in interface java.util.Collection
Specified by:
removeAll in interface java.util.Set
Overrides:
removeAll in class org.hibernate.collection.PersistentSet
See Also:
Set.removeAll(Collection)

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.Set
Overrides:
clear in class org.hibernate.collection.PersistentSet
See Also:
Set.clear()

beginRead

public void beginRead()
Specified by:
beginRead in interface org.hibernate.collection.PersistentCollection
Overrides:
beginRead in class org.hibernate.collection.PersistentSet

endRead

public boolean endRead()
Specified by:
endRead in interface org.hibernate.collection.PersistentCollection
Overrides:
endRead in class org.hibernate.collection.PersistentSet

getEntityByPKHexCode

public TCEntity getEntityByPKHexCode(java.lang.String pkHexCode)
Description copied from interface: IResultSetCollection
Gets the row in the collection by its PKHexCode. It is not made the current row in the resultset.

Specified by:
getEntityByPKHexCode in interface IResultSetCollection
Returns:
the TCEntity or null if not found.

getEntityAt

public TCEntity getEntityAt(int rowIndex)
Specified by:
getEntityAt in interface IResultSetCollection

getCurrentEntity

public TCEntity getCurrentEntity()
Specified by:
getCurrentEntity in interface IResultSetCollection

getLast

public TCEntity getLast()
Specified by:
getLast in interface IResultSetCollection

getFirst

public TCEntity getFirst()
Specified by:
getFirst in interface IResultSetCollection

getNext

public TCEntity getNext()
Specified by:
getNext in interface IResultSetCollection

getNextNth

public TCEntity getNextNth(int n)
Specified by:
getNextNth in interface IResultSetCollection

getPrevious

public TCEntity getPrevious()
Specified by:
getPrevious in interface IResultSetCollection

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface IResultSetCollection

isAtEnd

public boolean isAtEnd()
Specified by:
isAtEnd in interface IResultSetCollection

isAtBeginning

public boolean isAtBeginning()
Specified by:
isAtBeginning in interface IResultSetCollection

getCurrentNdx

public int getCurrentNdx()
Specified by:
getCurrentNdx in interface IResultSetCollection

delete

public void delete()
Specified by:
delete in interface IResultSetCollection

insertAtCurrentNdx

public void insertAtCurrentNdx(TCEntity obj)
Specified by:
insertAtCurrentNdx in interface IResultSetCollection

setCurrentNdx

public void setCurrentNdx(int currentNdx)
Specified by:
setCurrentNdx in interface IResultSetCollection

equals

public boolean equals(java.lang.Object other)
Specified by:
equals in interface java.util.Collection
Specified by:
equals in interface java.util.Set
Overrides:
equals in class org.hibernate.collection.PersistentSet

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.Set
Overrides:
hashCode in class org.hibernate.collection.PersistentSet