E - le type de l'entitepublic class TopiaDAOImpl<E extends TopiaEntity> extends Object implements TopiaDAO<E>
| Modifier and Type | Class and Description |
|---|---|
static class |
TopiaDAOImpl.FindAllIterator<E extends TopiaEntity,R> |
| Modifier and Type | Field and Description |
|---|---|
protected TopiaContext |
context
Underlying context used by this dao to do actions on db.
|
protected Class<E> |
entityClass
Type of entity managed by this dao.
|
protected TopiaFiresSupport |
topiaFiresSupport |
| Constructor and Description |
|---|
TopiaDAOImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addTopiaEntityListener(TopiaEntityListener listener) |
void |
addTopiaEntityVetoable(TopiaEntityVetoable vetoable) |
void |
computeAndAddRecordsToPager(String hql,
TopiaPagerBean pager,
Object... propertyNamesAndValues)
Execute the count
hql query and then synch the pager to this
result (says fill the
PagerBean.records field and then adapt
the number of pages available and the current number page). |
long |
count()
Count the number of existing entities.
|
long |
countByQuery(String hql,
Object... propertyNamesAndValues)
Count the number of entities based on a the given HQL query.
|
E |
create(E entity)
Creates an entity not created without the DAO.
|
E |
create(Map<String,Object> properties)
Cette methode appelle fireVetoableCreate et fireOnCreated Si vous la
surchargé, faites attention a appeler le super ou a appeler vous aussi
ces deux methodes.
|
E |
create(Object... propertyNamesAndValues)
Creates a new instance of the entity managed by the DAO
|
String |
createSimpleQuery(String alias)
Create the simple HQL query for the entity managed by the dao.
|
void |
delete(E e)
Removes the given entity from the storage
|
void |
deleteAll(Iterable<E> entities)
Permet de supprimer des entités.
|
boolean |
existByProperties(String propertyName,
Object propertyValue,
Object... propertyNamesAndValues)
Check the existence of an entity with
propertyName with propertyValue. |
boolean |
existByTopiaId(String id)
Check the existence of an entity with technical
id. |
boolean |
existsByQuery(String hql,
Object... propertyNamesAndValues)
Check the existence of an entity using the given HQL query.
|
List<E> |
findAll()
Finds all the entities managed by this DAO.
|
List<E> |
findAllByProperties(Map<String,Object> properties)
Finds all entities E matching all the
properties values. |
List<E> |
findAllByProperties(String propertyName,
Object value,
Object... propertyNamesAndValues)
Finds all entities E matching the given
propertyName, value
AND all other properties |
List<E> |
findAllByProperty(String propertyName,
Object value)
Finds all entities E which value for the given
propertyName is
value |
<R> List<R> |
findAllByQuery(Class<R> type,
String hql,
Object... propertyNamesAndValues)
Gets all entities when executing the given select query for the given
type which may not be a entity type (int, long, map,...). |
List<E> |
findAllByQuery(String hql,
Object... propertyNamesAndValues)
Finds all entities E when executing the given HQL query.
|
<R> List<R> |
findAllByQueryAndPager(Class<R> type,
String hql,
TopiaPagerBean pager,
Object... propertyNamesAndValues)
Finds a page of entities R of the given select
hql query using the
pager to obtain the window of entities to return. |
List<E> |
findAllByQueryAndPager(String hql,
TopiaPagerBean pager,
Object... propertyNamesAndValues)
Gets a page of entities E of the given select
hql query using the
pager to obtain the window of entities to return. |
<R> List<R> |
findAllByQueryWithBound(Class<R> type,
String hql,
int startIndex,
int endIndex,
Object... propertyNamesAndValues)
Finds a page of entities R when executing the given select query for the dao
entity type (will only return the window of
startIndex -
endIndex entities). |
List<E> |
findAllByQueryWithBound(String hql,
int startIndex,
int endIndex,
Object... propertyNamesAndValues)
Finds a page of entities E when executing the given select query for the dao
entity type (will only return the window of
startIndex -
endIndex entities). |
List<E> |
findAllContains(String propertyName,
Object value)
Find all the entities E which given collection (propertyName) contains the
given value
|
List<String> |
findAllIds()
Find all the ids for the E entity type
|
<R> Iterable<R> |
findAllLazyByQuery(Class<R> type,
int batchSize,
String hql,
Object... propertyNamesAndValues)
Finds all entities R in lazy mode when executing the given select query
for the given
type which may not be a entity type (int, long, map,...). |
<R> Iterable<R> |
findAllLazyByQuery(Class<R> type,
String hql,
Object... propertyNamesAndValues)
Finds all entities R in lazy mode when executing the given select query
for the given
type which may not be a entity type (int, long, map,...). |
Iterable<E> |
findAllLazyByQuery(int batchSize,
String hql,
Object... propertyNamesAndValues)
Finds all entities E in lazy mode when executing the given select query
for the dao entity type.
|
Iterable<E> |
findAllLazyByQuery(String hql,
Object... propertyNamesAndValues)
Finds all entities E in lazy mode when executing the given select query
for the dao entity type.
|
Map<Class<? extends TopiaEntity>,List<? extends TopiaEntity>> |
findAllUsages(E e)
Find all usages of the given
entity. |
List<E> |
findAllWithOrder(String... propertyNames)
Finds all entites E managed by this DAO.
|
E |
findByPrimaryKey(Map<String,Object> keys)
Find an entity using the natural ids.
|
E |
findByPrimaryKey(Object... k)
Find an entity using the natural ids.
|
E |
findByProperties(Map<String,Object> properties)
Find an entity matching
properties. |
E |
findByProperties(String propertyName,
Object value,
Object... propertyNamesAndValues)
Find an entity matching a succession of propertyName + value arguments.
|
E |
findByProperty(String propertyName,
Object value)
Find an entity matching
value for the given propertyName. |
<R> R |
findByQuery(Class<R> type,
String hql,
Object... params)
Executes and returns the result (entity R) of the given HQL query string.
|
E |
findByQuery(String hql,
Object... propertyNamesAndValues)
Executes and returns the result (entity E) of the given HQL query string.
|
E |
findByTopiaId(String id)
Find an entity corresponding to the
id. |
E |
findContains(String propertyName,
Object value)
Find the first entity which given collection (propertyName) contains the
given value
|
<U extends TopiaEntity> |
findUsages(Class<U> type,
E e)
Find usages of the given
entity in the entities of the given
type. |
int |
getBatchSize()
Obtains the batch size used to load data.
|
protected org.hibernate.metadata.ClassMetadata |
getClassMetadata()
package locale method because this is hibernate specific method and
we don't want expose it.
|
TopiaContextImplementor |
getContext()
Returns the context used by this DAO.
|
Class<E> |
getEntityClass()
Return the class of the entity managed by this DAO.
|
protected Serializable |
getId(E e)
Retourne l'id de l'entity
|
protected Serializable |
getId(Map map)
Retourne l'id de l'entity representer comme une map
|
List<Permission> |
getRequestPermission(String topiaId,
int actions)
Retourne les permissions a verifier pour l'acces a l'entite pour le
service Taas.
|
protected org.hibernate.Session |
getSession()
Renvoie la Session contenue dans le contexte
|
TopiaContext |
getTopiaContext()
Returns the context used by this DAO.
|
TopiaEntityEnum |
getTopiaEntityEnum()
Get the entityEnum of the type of entity managed by this DAO.
|
protected TopiaFiresSupport |
getTopiaFiresSupport() |
void |
init(TopiaContext context,
Class<E> entityClass,
TopiaFiresSupport topiaFiresSupport)
When AbstractTopiaContext create the TopiaDAOHibernate, it must call this
method just after.
|
Iterator<E> |
iterator() |
E |
newInstance()
Create a new instance of managed entity not persisted.
|
void |
removeTopiaEntityListener(TopiaEntityListener listener) |
void |
removeTopiaEntityVetoable(TopiaEntityVetoable vetoable) |
void |
setBatchSize(int batchSize)
Set a new default batch size.
|
E |
update(E e)
Update an entity.
|
protected Class<E extends TopiaEntity> entityClass
protected TopiaContext context
protected TopiaFiresSupport topiaFiresSupport
public TopiaEntityEnum getTopiaEntityEnum()
TopiaDAOgetTopiaEntityEnum in interface TopiaDAO<E extends TopiaEntity>public Class<E> getEntityClass()
TopiaDAOgetEntityClass in interface TopiaDAO<E extends TopiaEntity>public int getBatchSize()
TopiaDAOgetBatchSize in interface TopiaDAO<E extends TopiaEntity>public void setBatchSize(int batchSize)
TopiaDAOsetBatchSize in interface TopiaDAO<E extends TopiaEntity>batchSize - new batch size to use when iterating.public Iterator<E> iterator()
iterator in interface Iterable<E extends TopiaEntity>protected Serializable getId(E e) throws TopiaException
e - l'entityTopiaException - Si une erreur survient durant la rechercheprotected Serializable getId(Map map) throws TopiaException
map - l'entity en representation mapTopiaException - Si une erreur survient durant la recherchepublic void init(TopiaContext context, Class<E> entityClass, TopiaFiresSupport topiaFiresSupport) throws TopiaException
entityClass - TopiaExceptionpublic TopiaContextImplementor getContext()
TopiaDAOgetContext in interface TopiaDAO<E extends TopiaEntity>public TopiaContext getTopiaContext()
TopiaDAOgetTopiaContext in interface TopiaDAO<E extends TopiaEntity>protected TopiaFiresSupport getTopiaFiresSupport()
public String createSimpleQuery(String alias)
TopiaDAOFROM MyEntityImpl myAlias
createSimpleQuery in interface TopiaDAO<E extends TopiaEntity>alias - optional alias to use in querypublic E newInstance() throws TopiaException
TopiaDAOnewInstance in interface TopiaDAO<E extends TopiaEntity>TopiaException - if any pb while creating the entitypublic <U extends TopiaEntity> List<U> findUsages(Class<U> type, E e) throws TopiaException
TopiaDAOentity in the entities of the given
type.findUsages in interface TopiaDAO<E extends TopiaEntity>U - type of entity to searchtype - the type of entity to searche - the entity on which search is doneTopiaException - if any problem while getting datapublic Map<Class<? extends TopiaEntity>,List<? extends TopiaEntity>> findAllUsages(E e) throws TopiaException
TopiaDAOentity.findAllUsages in interface TopiaDAO<E extends TopiaEntity>e - the entityTopiaException - if any pb while getting datapublic List<Permission> getRequestPermission(String topiaId, int actions) throws TopiaException
TopiaDAOgetRequestPermission in interface TopiaDAO<E extends TopiaEntity>topiaId - topiaId d'une entiteactions - encoded actionsTopiaException - if any pb while getting dataspublic void addTopiaEntityListener(TopiaEntityListener listener)
addTopiaEntityListener in interface TopiaDAO<E extends TopiaEntity>public void addTopiaEntityVetoable(TopiaEntityVetoable vetoable)
addTopiaEntityVetoable in interface TopiaDAO<E extends TopiaEntity>public void removeTopiaEntityListener(TopiaEntityListener listener)
removeTopiaEntityListener in interface TopiaDAO<E extends TopiaEntity>public void removeTopiaEntityVetoable(TopiaEntityVetoable vetoable)
removeTopiaEntityVetoable in interface TopiaDAO<E extends TopiaEntity>public E create(E entity) throws TopiaException
TopiaDAOTopiaDAO.create(Object...)
would be to onerous.create in interface TopiaDAO<E extends TopiaEntity>entity - the instance to persistTopiaException - if any problem while creating datapublic E create(Object... propertyNamesAndValues) throws TopiaException
TopiaDAOcreate in interface TopiaDAO<E extends TopiaEntity>propertyNamesAndValues - the list of properties that the created entity will have. Arguments are key-value
paired : [propertyName;value;propertyName;value;...]TopiaException - if any problem during instantiationTopiaDAO.create(Map)public E create(Map<String,Object> properties) throws TopiaException
create in interface TopiaDAO<E extends TopiaEntity>properties - the key-value list of properties that the created entity will have.TopiaException - if any problem during instantiationpublic E update(E e) throws TopiaException
TopiaDAOupdate in interface TopiaDAO<E extends TopiaEntity>e - the entity to create or updateTopiaException - if any problem while updating dataspublic void delete(E e) throws TopiaException
TopiaDAOdelete in interface TopiaDAO<E extends TopiaEntity>e - the entity to removeTopiaException - if any problem while deleting dataspublic void deleteAll(Iterable<E> entities) throws TopiaException
TopiaDAOdeleteAll in interface TopiaDAO<E extends TopiaEntity>entities - les entités à supprimerTopiaException - if any pb while deleting dataspublic E findByTopiaId(String id) throws TopiaException
TopiaDAOid. If the id is
null, nothing will be searched.findByTopiaId in interface TopiaDAO<E extends TopiaEntity>id - topiaId of the entity to foundTopiaException - for Topia errors on querypublic E findByProperty(String propertyName, Object value) throws TopiaException
TopiaDAOvalue for the given propertyName.findByProperty in interface TopiaDAO<E extends TopiaEntity>propertyName - property name to filtervalue - value of the property to matchTopiaException - if any pb while getting dataspublic E findByProperties(String propertyName, Object value, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOfindByProperties in interface TopiaDAO<E extends TopiaEntity>propertyName - the first property name to filtervalue - the first value of the property to matchpropertyNamesAndValues - other property names and values. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic E findByProperties(Map<String,Object> properties) throws TopiaException
TopiaDAOproperties.findByProperties in interface TopiaDAO<E extends TopiaEntity>properties - the properties key + value to matchTopiaException - if any pb while getting dataspublic List<E> findAll() throws TopiaException
TopiaDAOfindAll in interface TopiaDAO<E extends TopiaEntity>TopiaException - if any pb while getting dataspublic List<String> findAllIds() throws TopiaException
TopiaDAOfindAllIds in interface TopiaDAO<E extends TopiaEntity>TopiaException - if any pb while getting dataspublic List<E> findAllByProperty(String propertyName, Object value) throws TopiaException
TopiaDAOpropertyName is
valuefindAllByProperty in interface TopiaDAO<E extends TopiaEntity>propertyName - property name to usevalue - value to expectTopiaException - if any pb while getting dataspublic List<E> findAllByProperties(String propertyName, Object value, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOpropertyName, value
AND all other propertiesfindAllByProperties in interface TopiaDAO<E extends TopiaEntity>propertyName - property name to usevalue - value to expectpropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic List<E> findAllByProperties(Map<String,Object> properties) throws TopiaException
TopiaDAOproperties values.findAllByProperties in interface TopiaDAO<E extends TopiaEntity>properties - properties to matchTopiaException - if any pb while getting dataspublic List<E> findAllWithOrder(String... propertyNames) throws TopiaException
TopiaDAOpropertyNames.
You can add on each property ASC or DESC to force the result order
(by default is ASC).findAllWithOrder in interface TopiaDAO<E extends TopiaEntity>propertyNames - property names of order to applyTopiaException - if any pb while getting dataspublic E findContains(String propertyName, Object value) throws TopiaException
TopiaDAOfindContains in interface TopiaDAO<E extends TopiaEntity>propertyName - the name of the property (must be a collection)value - the value to use for findTopiaException - if any pb while getting dataspublic List<E> findAllContains(String propertyName, Object value) throws TopiaException
TopiaDAOfindAllContains in interface TopiaDAO<E extends TopiaEntity>propertyName - the name of the property (must be a collection)value - the value to use for findTopiaException - if any pb while getting dataspublic boolean existByTopiaId(String id) throws TopiaException
TopiaDAOid.existByTopiaId in interface TopiaDAO<E extends TopiaEntity>id - unique id of the entity to test existence.TopiaException - for any errorpublic boolean existByProperties(String propertyName, Object propertyValue, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOpropertyName with propertyValue. others properties can be added to test
existence.existByProperties in interface TopiaDAO<E extends TopiaEntity>propertyName - the first property name to test existencepropertyValue - the first property value to test existencepropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - for Topia errorspublic long count()
throws TopiaException
TopiaDAOcount in interface TopiaDAO<E extends TopiaEntity>TopiaException - if any pb while getting dataspublic E findByPrimaryKey(Map<String,Object> keys) throws TopiaException
TopiaDAOfindByPrimaryKey in interface TopiaDAO<E extends TopiaEntity>keys - Map with the natural id property name as Map.key, and value as Map.valueTopiaException - if any pb while getting dataspublic E findByPrimaryKey(Object... k) throws TopiaException
TopiaDAOfindByPrimaryKey in interface TopiaDAO<E extends TopiaEntity>k - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic boolean existsByQuery(String hql, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOexistsByQuery in interface TopiaDAO<E extends TopiaEntity>hql - the HQL querypropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaExceptionpublic long countByQuery(String hql, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOcountByQuery in interface TopiaDAO<E extends TopiaEntity>hql - the HQL query to usepropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic E findByQuery(String hql, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOfindByQuery in interface TopiaDAO<E extends TopiaEntity>hql - the HQL querypropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic <R> R findByQuery(Class<R> type, String hql, Object... params) throws TopiaException
TopiaDAOfindByQuery in interface TopiaDAO<E extends TopiaEntity>type - the expected result typehql - the HQL queryparams - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic List<E> findAllByQuery(String hql, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOfindAllByQuery in interface TopiaDAO<E extends TopiaEntity>hql - the HQL querypropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic <R> List<R> findAllByQuery(Class<R> type, String hql, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOtype which may not be a entity type (int, long, map,...).findAllByQuery in interface TopiaDAO<E extends TopiaEntity>type - the expected result typehql - the HQL querypropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic Iterable<E> findAllLazyByQuery(String hql, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOfindAllLazyByQuery in interface TopiaDAO<E extends TopiaEntity>hql - the HQL querypropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic <R> Iterable<R> findAllLazyByQuery(Class<R> type, String hql, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOtype which may not be a entity type (int, long, map,...).
Important note: // TODO AThimel 20/07/13 Write the important note...findAllLazyByQuery in interface TopiaDAO<E extends TopiaEntity>type - the expected result typehql - the HQL querypropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic Iterable<E> findAllLazyByQuery(int batchSize, String hql, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOfindAllLazyByQuery in interface TopiaDAO<E extends TopiaEntity>batchSize - batch sizehql - the HQL querypropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic <R> Iterable<R> findAllLazyByQuery(Class<R> type, int batchSize, String hql, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOtype which may not be a entity type (int, long, map,...).
Important note: // TODO AThimel 20/07/13 Write the important note...findAllLazyByQuery in interface TopiaDAO<E extends TopiaEntity>type - the expected result typebatchSize - batch sizehql - the HQL querypropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic <R> List<R> findAllByQueryWithBound(Class<R> type, String hql, int startIndex, int endIndex, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOstartIndex -
endIndex entities).
// TODO AThimel 20/07/13 Reformulate(?) the "window thing"findAllByQueryWithBound in interface TopiaDAO<E extends TopiaEntity>type - the expected result typehql - the HQL querystartIndex - first index of entity to returnendIndex - last index of entity to returnpropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic List<E> findAllByQueryWithBound(String hql, int startIndex, int endIndex, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOstartIndex -
endIndex entities).
// TODO AThimel 20/07/13 Reformulate(?) the "window thing"findAllByQueryWithBound in interface TopiaDAO<E extends TopiaEntity>hql - the HQL querystartIndex - first index of entity to returnendIndex - last index of entity to returnpropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting dataspublic <R> List<R> findAllByQueryAndPager(Class<R> type, String hql, TopiaPagerBean pager, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOhql query using the
pager to obtain the window of entities to return.findAllByQueryAndPager in interface TopiaDAO<E extends TopiaEntity>type - the expected result typehql - the HQL querypager - pager to obtain the correct window of datapropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting datasTopiaPagerBeanpublic List<E> findAllByQueryAndPager(String hql, TopiaPagerBean pager, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOhql query using the
pager to obtain the window of entities to return.findAllByQueryAndPager in interface TopiaDAO<E extends TopiaEntity>hql - the HQL querypager - pager to obtain the correct window of datapropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting datasTopiaPagerBeanpublic void computeAndAddRecordsToPager(String hql, TopiaPagerBean pager, Object... propertyNamesAndValues) throws TopiaException
TopiaDAOhql query and then synch the pager to this
result (says fill the
PagerBean.records field and then adapt
the number of pages available and the current number page).computeAndAddRecordsToPager in interface TopiaDAO<E extends TopiaEntity>hql - the HQL query to usepager - pager to obtain the correct window of datapropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any pb while getting datasTopiaPagerBeanprotected org.hibernate.Session getSession()
throws TopiaException
TopiaException - if any pbprotected org.hibernate.metadata.ClassMetadata getClassMetadata()
throws TopiaException
TopiaException - if any pbCopyright © 2004–2013 CodeLutin. All rights reserved.