public interface TopiaContext
| Modifier and Type | Method and Description |
|---|---|
void |
add(TopiaEntity e)
Permet d'ajouter dans le TopiaContext une TopiaEntity créé par un autre
context.
|
void |
addPropertyChangeListener(PropertyChangeListener listener) |
void |
addTopiaContextListener(TopiaContextListener listener) |
void |
addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) |
void |
addTopiaEntityListener(Class<? extends TopiaEntity> entityClass,
TopiaEntityListener listener) |
void |
addTopiaEntityListener(TopiaEntityListener listener) |
void |
addTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass,
TopiaEntityVetoable vetoable) |
void |
addTopiaEntityVetoable(TopiaEntityVetoable vetoable) |
void |
addTopiaTransactionListener(TopiaTransactionListener listener) |
void |
addTopiaTransactionVetoable(TopiaTransactionVetoable vetoable) |
void |
backup(File file,
boolean compress)
Sauve la base de données dans un format natif a la base, la
representation n'est pas portable d'une base a l'autre.
|
TopiaContext |
beginTransaction()
Return a new context containing his own transaction.
|
void |
clear(boolean dropDatabase)
Supprime toutes les tables et autres elements de la database.
|
void |
clearCache()
Clear persistence implementation cache.
|
void |
closeContext()
Ferme le contexte.
|
void |
commitTransaction()
applique les modifications apporté a ce context sur la base de données.
|
TopiaQuery |
createQuery(Class<?> entityClass,
String alias)
Deprecated.
since 2.6.12,
TopiaQuery will be removed in version 3.0 |
void |
createSchema()
Permet de créer le schema de la base de données.
|
int |
execute(String hql,
Object... args)
Execute HQL operation on data (Update, Delete).
|
void |
executeSQL(String sqlScript)
Execute a given sql code inside this transaction.
|
List |
find(String hql,
int startIndex,
int endIndex,
Object... args)
Permet de faire une requete HQL hibernate directement sur la base en
precisant la fenetre des elements a remonter avec les parametres
startIndex et endIndex. |
List |
findAll(String hql,
Object... args)
Permet de faire une requete HQL hibernate directement sur la base.
|
List |
findByQuery(TopiaQuery query)
Deprecated.
since 2.6.12,
TopiaQuery will be removed in version 3.0 |
TopiaEntity |
findByTopiaId(String topiaId)
Retrieve
TopiaEntity using its unique id. |
Object |
findUnique(String jpaql,
Object... paramNamesAndValues)
Allow to do some HQL query and return an unique result.
|
<E extends TopiaService> |
getService(Class<E> interfaceService)
Return the service.
|
boolean |
isClosed()
Indique si le contexte a ete ferme.
|
void |
removePropertyChangeListener(PropertyChangeListener listener) |
void |
removeTopiaContextListener(TopiaContextListener listener) |
void |
removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) |
void |
removeTopiaEntityListener(Class<? extends TopiaEntity> entityClass,
TopiaEntityListener listener) |
void |
removeTopiaEntityListener(TopiaEntityListener listener) |
void |
removeTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass,
TopiaEntityVetoable vetoable) |
void |
removeTopiaEntityVetoable(TopiaEntityVetoable vetoable) |
void |
removeTopiaTransactionListener(TopiaTransactionListener listener) |
void |
removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable) |
void |
replicate(TopiaContext dstCtxt,
Object... entityAndCondition)
Permet de dupliquer de ce context vers un context d'une autre base des
données sans modification des entites.
|
<T extends TopiaEntity> |
replicateEntities(TopiaContext dstCtxt,
List<T> entities)
Permet de dupliquer les entités du type donné vers un autre context.
|
<T extends TopiaEntity> |
replicateEntity(TopiaContext dstCtxt,
T entity)
Permet de dupliquer une entité du type donné vers un autre context.
|
void |
restore(File file)
l'inverse de la methode
backup(File,boolean). |
void |
rollbackTransaction()
annule les modifications apporté a ce context.
|
<E extends TopiaService> |
serviceEnabled(Class<E> interfaceService)
Return true if specific service is available.
|
void |
showCreateSchema()
Permet d'afficher les requetes SQL de creation de base.
|
void |
updateSchema()
Permet de mettre à jour le schema de la base de données.
|
void addTopiaEntityListener(TopiaEntityListener listener)
void addTopiaEntityListener(Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener)
void addTopiaEntityVetoable(TopiaEntityVetoable vetoable)
void addTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable)
void addTopiaTransactionListener(TopiaTransactionListener listener)
void addTopiaTransactionVetoable(TopiaTransactionVetoable vetoable)
void addPropertyChangeListener(PropertyChangeListener listener)
void addTopiaContextListener(TopiaContextListener listener)
void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable)
void removeTopiaEntityListener(TopiaEntityListener listener)
void removeTopiaEntityListener(Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener)
void removeTopiaEntityVetoable(TopiaEntityVetoable vetoable)
void removeTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable)
void removeTopiaTransactionListener(TopiaTransactionListener listener)
void removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable)
void removePropertyChangeListener(PropertyChangeListener listener)
void removeTopiaContextListener(TopiaContextListener listener)
void removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable)
<E extends TopiaService> boolean serviceEnabled(Class<E> interfaceService)
E - type of serviceinterfaceService - fqn of the service<E extends TopiaService> E getService(Class<E> interfaceService) throws TopiaNotFoundException
E - type of serviceinterfaceService - class of the serviceTopiaNotFoundException - if service can't be retrievedvoid createSchema()
throws TopiaException
TopiaException - if any exceptionvoid showCreateSchema()
throws TopiaException
TopiaException - if any exceptionvoid updateSchema()
throws TopiaException
TopiaException - if any exceptionTopiaContext beginTransaction() throws TopiaException
TopiaException - if any exceptionvoid commitTransaction()
throws TopiaException
TopiaException - if any exceptionvoid rollbackTransaction()
throws TopiaException
TopiaException - if any exceptionTopiaEntity findByTopiaId(String topiaId) throws TopiaException
TopiaEntity using its unique id.topiaId - unique identifier of the entity in all the application.TopiaException - for errors on retrieving the entity@Deprecated List findByQuery(TopiaQuery query) throws TopiaException
TopiaQuery will be removed in version 3.0query. Generally this method
is used for complex query where output type is specific (more than one
element in the SELECT).query - TopiaQuery to executeTopiaException@Deprecated TopiaQuery createQuery(Class<?> entityClass, String alias)
TopiaQuery will be removed in version 3.0entityClass - main entity class for the Queryalias - alias of the entity in the QueryTopiaQueryList findAll(String hql, Object... args) throws TopiaException
hql - la requete a faireargs - les arguments de la requeteTopiaException - si une erreur survient durant la requeteList find(String hql, int startIndex, int endIndex, Object... args) throws TopiaException
startIndex et endIndex.hql - la requete a fairestartIndex - la position du premier element a remonterendIndex - la position du dernier element a remonterargs - les arguments de la requeteTopiaException - si une erreur survient durant la requeteObject findUnique(String jpaql, Object... paramNamesAndValues) throws TopiaException
jpaql - the JPA-QL query to executeparamNamesAndValues - an array of query parameters based on
[key,value,key,value,...]TopiaException - for any error during querying or if the the query
returns more than one result.int execute(String hql, Object... args) throws TopiaException
hql - la requete a faireargs - les arguments de la requeteTopiaException - if any exceptionvoid add(TopiaEntity e) throws TopiaException
e - l'entity a ajouterTopiaException - if any exceptionvoid replicate(TopiaContext dstCtxt, Object... entityAndCondition) throws TopiaException, IllegalArgumentException
entityAndCondition est vide,
alors on duplique toutes les entités de la base.
Note 2: Il se peut que la replication simple ne soit pas
suffisante (par example si l'on veut repliquer q'une partie d'une
entité), on utilisera donc la seconde méthode replicateEntities(TopiaContext, List).dstCtxt - le context de la base destinationentityAndCondition - paramètre qui vont par deux, qui represente la
classe de l'entity a exporter et la condition
where que doit respecter l'objet pour etre
exporter (entityClass, condition)TopiaException - si une erreur pendant la duplicationIllegalArgumentException - si l'un des context n'est pas ouvert, ou
si on essaye de dupliquer dans la même
base.<T extends TopiaEntity> void replicateEntity(TopiaContext dstCtxt, T entity) throws TopiaException, IllegalArgumentException
T - le type des entités à répliquerdstCtxt - le context de la base destinationentity - l'entité à répliquerTopiaException - si une erreur pendant la duplicationIllegalArgumentException - si l'un des context n'est pas ouvert, ou
si on essaye de dupliquer dans la même
base.<T extends TopiaEntity> void replicateEntities(TopiaContext dstCtxt, List<T> entities) throws TopiaException, IllegalArgumentException
T - le type des entités à répliquerdstCtxt - le context de la base destinationentities - les entités à répliquerTopiaException - si une erreur pendant la duplicationIllegalArgumentException - si l'un des context n'est pas ouvert, ou
si on essaye de dupliquer dans la même
base.void backup(File file, boolean compress) throws TopiaException
file - le nom du fichier ou stocker les informationscompress - si vrai compress le fichier avec gzipTopiaException - if any exceptionvoid clear(boolean dropDatabase)
throws TopiaException
dropDatabase - si vrai alors supprime aussi la base de données si la
base utilise des fichiers les fichiers seront
supprimé (ex: h2) ou sera fait sur la base
(postgresql)TopiaException - if any exceptionvoid clearCache()
throws TopiaException
TopiaExceptionvoid restore(File file) throws TopiaException
backup(File,boolean).file - le fichier ou prendre les informations, il peut-etre
compressé avec gzip ou non.TopiaException - if any exceptionvoid closeContext()
throws TopiaException
TopiaException - if any exceptionboolean isClosed()
true si le context est ferme, false autrementvoid executeSQL(String sqlScript) throws TopiaException
sqlScript - the sql script to executeTopiaException - if any problem occurs while executing the sql script.Copyright © 2004–2022 Code Lutin. All rights reserved.