de.nava.informa.utils.manager.hibernate
Class SpringPersistenceManager

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by de.nava.informa.utils.manager.hibernate.SpringPersistenceManager
All Implemented Interfaces:
PersistenceManagerIF, InitializingBean

public class SpringPersistenceManager
extends HibernateDaoSupport
implements PersistenceManagerIF

Implementation of Informa's PersistenceManagerIF interface with the Hibernate O/R mapper as backend, making use of the DAO class provided by the Spring Framework. The aim is to ease integration of informa into an Spring scenario.

Since:
Informa 0.7
Author:
Niko Schmuck

Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
SpringPersistenceManager()
           
 
Method Summary
 void addChannelToGroup(ChannelIF channel, ChannelGroupIF group)
          Adds channel to the group.
 ChannelIF createChannel(String title, URL location)
          Creates new channel object and persists it into storage.
 ChannelGroupIF createGroup(String title)
          Creates new group of channels in persistent storage.
 ItemIF createItem(ChannelIF channel, ItemIF ethalon)
          Creates new item using specified object as ethalon.
 ItemIF createItem(ChannelIF channel, String title)
          Creates new item in the channel.
 void deleteChannel(ChannelIF channel)
          Deletes channel from persistent storage.
 void deleteGroup(ChannelGroupIF group)
          Deletes group from persistent storage.
 void deleteItem(ItemIF item)
          Deletes the item from the persistent storage.
 ChannelGroupIF[] getGroups()
          Returns the list of groups available in database.
 void mergeGroups(ChannelGroupIF first, ChannelGroupIF second)
          Takes channels from the second group and put them all in first group.
 void removeChannelFromGroup(ChannelIF channel, ChannelGroupIF group)
          Deletes channel from the group.
 void updateChannel(ChannelIF channel)
          Updates data in database with data from channel object.
 void updateGroup(ChannelGroupIF group)
          Updates data in storage with data from the group object.
 void updateItem(ItemIF item)
          Updates data in database with data from item object.
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, 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
 

Constructor Detail

SpringPersistenceManager

public SpringPersistenceManager()
Method Detail

createGroup

public ChannelGroupIF createGroup(String title)
                           throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Creates new group of channels in persistent storage.

Specified by:
createGroup in interface PersistenceManagerIF
Parameters:
title - title of the group.
Returns:
initialized and persisted group object.
Throws:
PersistenceManagerException - in case of any problems.

updateGroup

public void updateGroup(ChannelGroupIF group)
                 throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Updates data in storage with data from the group object.

Specified by:
updateGroup in interface PersistenceManagerIF
Parameters:
group - group object
Throws:
PersistenceManagerException - in case of any problems.

deleteGroup

public void deleteGroup(ChannelGroupIF group)
                 throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Deletes group from persistent storage.

Specified by:
deleteGroup in interface PersistenceManagerIF
Parameters:
group - group to delete.
Throws:
PersistenceManagerException - in case of any problems.

mergeGroups

public void mergeGroups(ChannelGroupIF first,
                        ChannelGroupIF second)
                 throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Takes channels from the second group and put them all in first group. Then second group is deleted.

Specified by:
mergeGroups in interface PersistenceManagerIF
Parameters:
first - first group of channels.
second - second group of channels.
Throws:
PersistenceManagerException - in case of any problems.

getGroups

public ChannelGroupIF[] getGroups()
                           throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Returns the list of groups available in database.

Specified by:
getGroups in interface PersistenceManagerIF
Returns:
list of groups.
Throws:
PersistenceManagerException - in case of any problems.

createChannel

public ChannelIF createChannel(String title,
                               URL location)
                        throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Creates new channel object and persists it into storage.

Specified by:
createChannel in interface PersistenceManagerIF
Parameters:
title - title of the channel.
location - location of channel data resource.
Returns:
newly created object.
Throws:
PersistenceManagerException - in case of any problems.

updateChannel

public void updateChannel(ChannelIF channel)
                   throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Updates data in database with data from channel object.

Specified by:
updateChannel in interface PersistenceManagerIF
Parameters:
channel - channel object.
Throws:
PersistenceManagerException - in case of any problems.

addChannelToGroup

public void addChannelToGroup(ChannelIF channel,
                              ChannelGroupIF group)
                       throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Adds channel to the group.

Specified by:
addChannelToGroup in interface PersistenceManagerIF
Parameters:
channel - channel to add.
group - group to use.
Throws:
PersistenceManagerException - in case of any problems.

removeChannelFromGroup

public void removeChannelFromGroup(ChannelIF channel,
                                   ChannelGroupIF group)
                            throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Deletes channel from the group. This method doesn't delete channel from persistent storage. It only breaks the association between channel and group.

Specified by:
removeChannelFromGroup in interface PersistenceManagerIF
Parameters:
channel - channel to delete.
group - group to use.
Throws:
PersistenceManagerException - in case of any problems.

deleteChannel

public void deleteChannel(ChannelIF channel)
                   throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Deletes channel from persistent storage.

Specified by:
deleteChannel in interface PersistenceManagerIF
Parameters:
channel - channel to delete.
Throws:
PersistenceManagerException - in case of any problems.

createItem

public ItemIF createItem(ChannelIF channel,
                         String title)
                  throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Creates new item in the channel.

Specified by:
createItem in interface PersistenceManagerIF
Parameters:
channel - channel to put new item into.
title - title of new item.
Returns:
new item object.
Throws:
PersistenceManagerException - in case of any problems.

createItem

public ItemIF createItem(ChannelIF channel,
                         ItemIF ethalon)
                  throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Creates new item using specified object as ethalon. Note that application could already add object to the channel and only persistent modifications required.

Specified by:
createItem in interface PersistenceManagerIF
Parameters:
channel - channel to put new item into.
ethalon - object to copy properties values from.
Returns:
new item object.
Throws:
PersistenceManagerException - in case of any problems.

updateItem

public void updateItem(ItemIF item)
                throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Updates data in database with data from item object.

Specified by:
updateItem in interface PersistenceManagerIF
Parameters:
item - item object.
Throws:
PersistenceManagerException - in case of any errors.

deleteItem

public void deleteItem(ItemIF item)
                throws PersistenceManagerException
Description copied from interface: PersistenceManagerIF
Deletes the item from the persistent storage.

Specified by:
deleteItem in interface PersistenceManagerIF
Parameters:
item - item to delete.
Throws:
PersistenceManagerException - in case of any problems.


Copyright © 2002-2007 Niko Schmuck. All Rights Reserved.