org.riotfamily.riot.hibernate.dao
Class HqlParentChildDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by org.riotfamily.riot.hibernate.dao.AbstractHibernateRiotDao
              extended by org.riotfamily.riot.hibernate.dao.AbstractHqlDao
                  extended by org.riotfamily.riot.hibernate.dao.HqlDao
                      extended by org.riotfamily.riot.hibernate.dao.HqlParentChildDao
All Implemented Interfaces:
CutAndPasteEnabledDao, ParentChildDao, RiotDao, SortableDao, SwappableItemDao, InitializingBean

public class HqlParentChildDao
extends HqlDao
implements ParentChildDao, CutAndPasteEnabledDao

ParentChildDao implementation based on Hibernate.


Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
HqlParentChildDao(org.hibernate.SessionFactory sessionFactory)
           
 
Method Summary
 void addChild(Object entity, Object parent)
          Adds the entity to a new parent.
 void delete(Object entity, Object parent)
          Deletes the given entity.
 Object getParent(Object entity)
           
 String getParentProperty()
           
protected  String getWhereClause(Object parent, ListParams params)
           
protected  void initDao()
           
protected  void initParentChildDao()
           
 void removeChild(Object entity, Object parent)
          This method does nothing.
 void save(Object entity, Object parent)
          Saves the given entity.
 void setParentProperty(String parentProperty)
           
protected  void setQueryParameters(org.hibernate.Query query, Object parent, ListParams params)
           
 
Methods inherited from class org.riotfamily.riot.hibernate.dao.HqlDao
buildMaxPositionHql, getEntityClass, getOrderBy, getSelect, getWhere, isPolymorph, isSetPositionOnSave, setEntityClass, setPolymorph, setPositionIfNeeded, setPositionProperty, setSelect, setSetPositionOnSave, setWhere, swapEntity
 
Methods inherited from class org.riotfamily.riot.hibernate.dao.AbstractHqlDao
buildCountHql, buildHql, getFilterWhereClause, getFrom, getListSize, getSearchWhereClause, isPrefixSearch, isSuffixSearch, listInternal, setFilterParameters
 
Methods inherited from class org.riotfamily.riot.hibernate.dao.AbstractHibernateRiotDao
getObjectId, list, load, merge, update
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.riotfamily.riot.dao.RiotDao
getEntityClass, getListSize, getObjectId, list, load, merge, update
 
Methods inherited from interface org.riotfamily.riot.dao.RiotDao
getEntityClass, getListSize, getObjectId, list, load, merge, update
 

Constructor Detail

HqlParentChildDao

public HqlParentChildDao(org.hibernate.SessionFactory sessionFactory)
Method Detail

getParentProperty

public String getParentProperty()

setParentProperty

public void setParentProperty(String parentProperty)

initDao

protected final void initDao()
                      throws Exception
Overrides:
initDao in class DaoSupport
Throws:
Exception

initParentChildDao

protected void initParentChildDao()
                           throws Exception
Throws:
Exception

getParent

public Object getParent(Object entity)
Specified by:
getParent in interface ParentChildDao

save

public void save(Object entity,
                 Object parent)
Description copied from interface: RiotDao
Saves the given entity.

Specified by:
save in interface RiotDao
Overrides:
save in class HqlDao

delete

public void delete(Object entity,
                   Object parent)
Description copied from interface: RiotDao
Deletes the given entity.

Specified by:
delete in interface RiotDao
Overrides:
delete in class AbstractHibernateRiotDao

getWhereClause

protected String getWhereClause(Object parent,
                                ListParams params)
Overrides:
getWhereClause in class AbstractHqlDao

setQueryParameters

protected void setQueryParameters(org.hibernate.Query query,
                                  Object parent,
                                  ListParams params)
Overrides:
setQueryParameters in class AbstractHqlDao

addChild

public void addChild(Object entity,
                     Object parent)
Description copied from interface: CutAndPasteEnabledDao
Adds the entity to a new parent.

Specified by:
addChild in interface CutAndPasteEnabledDao

removeChild

public void removeChild(Object entity,
                        Object parent)
This method does nothing. Before the parentProperty was set to null here. But since the only call is from the Clipboard's pasteCut method, which calls this after the addChild is called, setting the parentProperty to null won't have the desired effect.

Specified by:
removeChild in interface CutAndPasteEnabledDao