magoffin.matt.ma2.dao.hbm
Class HibernateCollectionDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by magoffin.matt.dao.hbm.GenericHibernateDao<T,PK>
              extended by magoffin.matt.dao.hbm.GenericIndexableHibernateDao<Collection,java.lang.Long>
                  extended by magoffin.matt.ma2.dao.hbm.HibernateCollectionDao
All Implemented Interfaces:
magoffin.matt.dao.GenericDao<Collection,java.lang.Long>, magoffin.matt.dao.IndexableDao<java.lang.Long>, CollectionDao, org.springframework.beans.factory.InitializingBean

public class HibernateCollectionDao
extends magoffin.matt.dao.hbm.GenericIndexableHibernateDao<Collection,java.lang.Long>
implements CollectionDao

Hibernate implementation of CollectionDao.

Version:
$Revision: 43 $ $Date: 2007-10-21 11:10:01 +1300 (Sun, 21 Oct 2007) $
Author:
matt.magoffin

Nested Class Summary
 
Nested classes/interfaces inherited from class magoffin.matt.dao.hbm.GenericHibernateDao
magoffin.matt.dao.hbm.GenericHibernateDao.UpdateMode
 
Field Summary
static java.lang.String QUERY_COLLECTION_FOR_ITEM_ID
          Find a Collection for an Item ID.
static java.lang.String QUERY_COLLECTIONS_FOR_USER_ID
          Find all Collections for a User ID.
 
Fields inherited from class magoffin.matt.dao.hbm.GenericIndexableHibernateDao
DEFAULT_INDEX_BATCH_SIZE
 
Fields inherited from class magoffin.matt.dao.hbm.GenericHibernateDao
DEFAULT_BATCH_FLUSH_COUNT, log
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
HibernateCollectionDao()
          Default constructor.
 
Method Summary
 java.util.List<Collection> findCollectionsForUser(java.lang.Long userId)
          Find all collections owned by a given user.
 Collection getCollectionForMediaItem(java.lang.Long mediaItemId)
          Get the collection a MediaItem is in.
 Collection getCollectionWithItems(java.lang.Long collectionId)
          Get an Collection with it's items fully populated.
protected  java.lang.Long getPrimaryKey(Collection domainObject)
           
 
Methods inherited from class magoffin.matt.dao.hbm.GenericIndexableHibernateDao
getIndexBatchSize, getIndexObjectIdColumnName, getIndexObjectTableAlias, getIndexRowMapper, getIndexTimeZone, getJdbcTemplate, getSqlIndexAll, getSqlIndexDateRange, getSqlParamIdxWithDateRange, index, populateIndexRow, setIndexBatchSize, setIndexObjectIdColumnName, setIndexObjectTableAlias, setIndexRowMapper, setIndexTimeZone, setJdbcTemplate, setSqlIndexAll, setSqlIndexDateRange, setSqlParamIdxWithDateRange
 
Methods inherited from class magoffin.matt.dao.hbm.GenericHibernateDao
delete, executeLiveCriteriaBatchCallback, executeNamedQueryBatchCallback, executeStatelessCriteriaBatchCallback, findByNamedQuery, findByNamedQuery, findByNamedQuery, findByNamedQuery, findByNamedQuery, get, getBatchFlushCount, getType, getUpdateMode, save, setBatchFlushCount, setUpdateMode, store, update
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, closeSessionIfNecessary, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface magoffin.matt.dao.GenericDao
delete, get, store
 

Field Detail

QUERY_COLLECTIONS_FOR_USER_ID

public static final java.lang.String QUERY_COLLECTIONS_FOR_USER_ID
Find all Collections for a User ID.

See Also:
Constant Field Values

QUERY_COLLECTION_FOR_ITEM_ID

public static final java.lang.String QUERY_COLLECTION_FOR_ITEM_ID
Find a Collection for an Item ID.

See Also:
Constant Field Values
Constructor Detail

HibernateCollectionDao

public HibernateCollectionDao()
Default constructor.

Method Detail

getPrimaryKey

protected java.lang.Long getPrimaryKey(Collection domainObject)
Specified by:
getPrimaryKey in class magoffin.matt.dao.hbm.GenericHibernateDao<Collection,java.lang.Long>

findCollectionsForUser

public java.util.List<Collection> findCollectionsForUser(java.lang.Long userId)
Description copied from interface: CollectionDao
Find all collections owned by a given user.

Specified by:
findCollectionsForUser in interface CollectionDao
Parameters:
userId - the ID of the user to find the collections for
Returns:
list of found collections, or empty List if none found

getCollectionForMediaItem

public Collection getCollectionForMediaItem(java.lang.Long mediaItemId)
Description copied from interface: CollectionDao
Get the collection a MediaItem is in.

Specified by:
getCollectionForMediaItem in interface CollectionDao
Parameters:
mediaItemId - the ID of the media item
Returns:
the collection

getCollectionWithItems

public Collection getCollectionWithItems(java.lang.Long collectionId)
Description copied from interface: CollectionDao
Get an Collection with it's items fully populated.

Specified by:
getCollectionWithItems in interface CollectionDao
Parameters:
collectionId - the ID of the collection
Returns:
the Collection, or null if not found