org.iternine.jeppetto.dao.hibernate
Class HibernateQueryModelDAO<T,ID extends Serializable>

java.lang.Object
  extended by org.iternine.jeppetto.dao.hibernate.HibernateQueryModelDAO<T,ID>
Type Parameters:
T - persistent class.
ID - ID type for the persistent class.
All Implemented Interfaces:
AccessControllable<ID>, GenericDAO<T,ID>, QueryModelDAO<T,ID>

public class HibernateQueryModelDAO<T,ID extends Serializable>
extends Object
implements QueryModelDAO<T,ID>, AccessControllable<ID>

An implementation of the QueryModelDAO interface that supports Hibernate.


Constructor Summary
protected HibernateQueryModelDAO(Class<T> persistentClass, Map<String,Object> daoProperties)
           
protected HibernateQueryModelDAO(Class<T> persistentClass, Map<String,Object> daoProperties, AccessControlContextProvider accessControlContextProvider)
           
 
Method Summary
 Condition buildCondition(String conditionField, ConditionType conditionType, Iterator argsIterator)
           
protected  Condition buildIdCondition(ID id)
           
 Projection buildProjection(String projectionField, ProjectionType projectionType, Iterator argsIterator)
           
 void delete(T entity)
           
 void deleteById(ID id)
           
 void deleteUsingQueryModel(QueryModel queryModel)
           
 Iterable<T> findAll()
           
 T findById(ID id)
           
 T findUniqueUsingQueryModel(QueryModel queryModel)
           
 Iterable<T> findUsingQueryModel(QueryModel queryModel)
           
 void flush()
           
 AccessControlContextProvider getAccessControlContextProvider()
           
protected  org.hibernate.Session getCurrentSession()
           
 AccessType getGrantedAccess(ID id, String accessId)
           
 Map<String,AccessType> getGrantedAccesses(ID id)
           
 void grantAccess(ID id, String accessId, AccessType accessType)
           
 Object projectUsingQueryModel(QueryModel queryModel)
           
 void revokeAccess(ID id, String accessId)
           
 void save(T entity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateQueryModelDAO

protected HibernateQueryModelDAO(Class<T> persistentClass,
                                 Map<String,Object> daoProperties)

HibernateQueryModelDAO

protected HibernateQueryModelDAO(Class<T> persistentClass,
                                 Map<String,Object> daoProperties,
                                 AccessControlContextProvider accessControlContextProvider)
Method Detail

findById

public T findById(ID id)
           throws NoSuchItemException,
                  JeppettoException
Specified by:
findById in interface GenericDAO<T,ID extends Serializable>
Throws:
NoSuchItemException
JeppettoException

findAll

public Iterable<T> findAll()
                    throws JeppettoException
Specified by:
findAll in interface GenericDAO<T,ID extends Serializable>
Throws:
JeppettoException

save

public void save(T entity)
          throws OptimisticLockException,
                 JeppettoException
Specified by:
save in interface GenericDAO<T,ID extends Serializable>
Throws:
OptimisticLockException
JeppettoException

delete

public void delete(T entity)
            throws JeppettoException
Specified by:
delete in interface GenericDAO<T,ID extends Serializable>
Throws:
JeppettoException

deleteById

public void deleteById(ID id)
                throws JeppettoException
Specified by:
deleteById in interface GenericDAO<T,ID extends Serializable>
Throws:
JeppettoException

flush

public void flush()
           throws JeppettoException
Specified by:
flush in interface GenericDAO<T,ID extends Serializable>
Throws:
JeppettoException

findUniqueUsingQueryModel

public T findUniqueUsingQueryModel(QueryModel queryModel)
                            throws NoSuchItemException,
                                   TooManyItemsException,
                                   JeppettoException
Specified by:
findUniqueUsingQueryModel in interface QueryModelDAO<T,ID extends Serializable>
Throws:
NoSuchItemException
TooManyItemsException
JeppettoException

findUsingQueryModel

public Iterable<T> findUsingQueryModel(QueryModel queryModel)
                                throws JeppettoException
Specified by:
findUsingQueryModel in interface QueryModelDAO<T,ID extends Serializable>
Throws:
JeppettoException

projectUsingQueryModel

public Object projectUsingQueryModel(QueryModel queryModel)
                              throws JeppettoException
Specified by:
projectUsingQueryModel in interface QueryModelDAO<T,ID extends Serializable>
Throws:
JeppettoException

deleteUsingQueryModel

public void deleteUsingQueryModel(QueryModel queryModel)
                           throws JeppettoException
Specified by:
deleteUsingQueryModel in interface QueryModelDAO<T,ID extends Serializable>
Throws:
JeppettoException

buildCondition

public Condition buildCondition(String conditionField,
                                ConditionType conditionType,
                                Iterator argsIterator)
Specified by:
buildCondition in interface QueryModelDAO<T,ID extends Serializable>

buildProjection

public Projection buildProjection(String projectionField,
                                  ProjectionType projectionType,
                                  Iterator argsIterator)
Specified by:
buildProjection in interface QueryModelDAO<T,ID extends Serializable>

grantAccess

public void grantAccess(ID id,
                        String accessId,
                        AccessType accessType)
                 throws NoSuchItemException,
                        AccessControlException
Specified by:
grantAccess in interface AccessControllable<ID extends Serializable>
Throws:
NoSuchItemException
AccessControlException

revokeAccess

public void revokeAccess(ID id,
                         String accessId)
                  throws NoSuchItemException,
                         AccessControlException
Specified by:
revokeAccess in interface AccessControllable<ID extends Serializable>
Throws:
NoSuchItemException
AccessControlException

getGrantedAccess

public AccessType getGrantedAccess(ID id,
                                   String accessId)
                            throws NoSuchItemException,
                                   AccessControlException
Specified by:
getGrantedAccess in interface AccessControllable<ID extends Serializable>
Throws:
NoSuchItemException
AccessControlException

getGrantedAccesses

public Map<String,AccessType> getGrantedAccesses(ID id)
                                          throws NoSuchItemException,
                                                 AccessControlException
Specified by:
getGrantedAccesses in interface AccessControllable<ID extends Serializable>
Throws:
NoSuchItemException
AccessControlException

getAccessControlContextProvider

public AccessControlContextProvider getAccessControlContextProvider()
Specified by:
getAccessControlContextProvider in interface AccessControllable<ID extends Serializable>

getCurrentSession

protected org.hibernate.Session getCurrentSession()

buildIdCondition

protected Condition buildIdCondition(ID id)


Copyright © 2012. All Rights Reserved.