public class AbstractTopiaContext extends Object implements TopiaContext, TopiaContextImplementor
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractTopiaContext.SQLWork |
| Modifier and Type | Field and Description |
|---|---|
protected Set<TopiaContextImplementor> |
childContext
Set of child context created with
beginTransaction(). |
protected boolean |
closed
Indique si le contexte a ete ferme
|
protected Properties |
config
Propriete de configuration
|
protected Map<Class<? extends TopiaEntity>,TopiaDAO<? extends TopiaEntity>> |
daoCache
cache des DAO deja chargé pour ce context
|
protected TopiaFiresSupport |
firesSupport |
protected org.hibernate.Session |
hibernate
La session utilisé par le AbstractTopiaContext
|
protected org.hibernate.cfg.Configuration |
hibernateConfiguration
L'objet configuration utilisé pour la creation de la factory hibernate
|
protected org.hibernate.SessionFactory |
hibernateFactory
la factory permettant de recuperer la session hibernate.
|
protected TopiaContextImplementor |
parentContext
Deprecated.
Hierarchical context are not supported anymore
|
protected List<Class<?>> |
persistenceClasses
Liste des classes perssitance
|
protected Map<String,TopiaService> |
services
key: service name; value: service instance
|
protected TopiaIdFactory |
topiaIdFactory
Used to affect a new topiaId when create is called.
|
protected boolean |
useFlushMode
This flag permits to use (or not) the flush mode when doing queries.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTopiaContext()
Default constructor, useful for tests.
|
|
AbstractTopiaContext(Properties config)
Constructor used by
TopiaContextFactory to initialize rootContext
using config. |
protected |
AbstractTopiaContext(TopiaContextImplementor parentContext)
Constructor used by
beginTransaction() to instantiate child from
parentContext. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(TopiaEntity e)
Add into this TopiaContext an entity created by another TopiaContext
|
protected void |
addChildContext(TopiaContextImplementor child) |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Register to the context a PropertyChangeListener about some entity's
property change.
|
void |
addTopiaContextListener(TopiaContextListener listener)
Deprecated.
|
void |
addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable)
Register to the context a TopiaEntitiesVetoable about any TopiaEntity.
|
void |
addTopiaEntityListener(Class<? extends TopiaEntity> entityClass,
TopiaEntityListener listener)
Register to the context a TopiaEntityListener about the given entity
class.
|
void |
addTopiaEntityListener(TopiaEntityListener listener)
Register to the context a TopiaEntityListener about any TopiaEntity.
|
void |
addTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass,
TopiaEntityVetoable vetoable)
Register to the context a TopiaEntityVetoable about the given entity
class.
|
void |
addTopiaEntityVetoable(TopiaEntityVetoable vetoable)
Register to the context a TopiaEntityVetoable about any TopiaEntity.
|
void |
addTopiaSchemaListener(TopiaSchemaListener listener)
Register to the context a TopiaSchemaListener about any schema
modification.
|
void |
addTopiaTransactionListener(TopiaTransactionListener listener)
Register to the context a TopiaTransactionListener about the transaction.
|
void |
addTopiaTransactionVetoable(TopiaTransactionVetoable vetoable)
Register to the context a TopiaTransactionVetoable about the transaction.
|
void |
backup(File file,
boolean compress)
Backup database in gzip compressed file.
|
TopiaContext |
beginTransaction()
Returns a new context containing its own transaction.
|
protected String[] |
buildQueries(Object... entityAndCondition)
Build the list of queries from the given parameter
entityAndCondition. |
protected void |
checkClosed(String message) |
void |
clear(boolean dropDatabase)
Only h2 supported for now
|
void |
clearCache()
Clear hibernate cache to free memory.
|
void |
closeContext()
Closes the context.
|
void |
commitTransaction()
Applies all the modifications made to this context on the persistence
device.
|
void |
createSchema()
Triggers database schema creation
|
void |
dropSchema() |
int |
execute(String jpaql,
Map<String,Object> parameters)
Execute JPA-QL operation on data (Update, Delete).
|
int |
execute(String jpaql,
Object... propertyNamesAndValues)
Execute HQL operation on data (Update, Delete)
|
void |
executeSQL(String sqlScript)
Execute a given sql code inside this transaction.
|
protected void |
finalize()
Pour le context root on ferme tous les fils, et la factory hibernate.
|
<T> List<T> |
find(String jpaql,
int startIndex,
int endIndex,
Map<String,Object> parameters)
Allow to do some JPA-QL query using the given bounds.
|
<E> List<E> |
find(String jpaql,
int startIndex,
int endIndex,
Object... propertyNamesAndValues)
Allow to do some JPA-QL query using the given bounds.
|
<T> List<T> |
findAll(String jpaql,
Map<String,Object> parameters)
Allow to do some JPA-QL query
WARNING : Depending on the registered service, this method may not
support something else than queries on TopiaEntity
|
<E> List<E> |
findAll(String jpaql,
Object... propertyNamesAndValues)
Allow to do some HQL query
WARNING : Depending on the registered service, this method may not
support something else than queries on TopiaEntity
|
<E extends TopiaEntity> |
findByTopiaId(String id)
Retrieve
TopiaEntity using its unique id. |
<T> T |
findUnique(String jpaql,
Map<String,Object> parameters)
Allow to do some JPA-QL query and return an unique result.
|
<E> E |
findUnique(String jpaql,
Object... propertyNamesAndValues)
Allow to do some HQL query and return an unique result.
|
Set<TopiaContextImplementor> |
getChildContext()
Retrieve a thread-safe copy of children context set.
|
Properties |
getConfig() |
<E extends TopiaEntity> |
getDao(Class<E> entityClass)
Get DAO for specified class.
|
<E extends TopiaEntity,D extends TopiaDAO<E>> |
getDao(Class<E> entityClass,
Class<D> daoClass)
Get DAO for specified class.
|
TopiaFiresSupport |
getFiresSupport() |
org.hibernate.Session |
getHibernate() |
org.hibernate.cfg.Configuration |
getHibernateConfiguration() |
org.hibernate.SessionFactory |
getHibernateFactory() |
org.hibernate.Session |
getHibernateSession() |
TopiaContextImplementor |
getParentContext() |
List<Class<?>> |
getPersistenceClasses() |
protected String |
getProperExceptionMessage(Throwable eee) |
TopiaContextImplementor |
getRootContext() |
String |
getSchemaName() |
<E extends TopiaService> |
getService(Class<E> interfaceService)
Take one service, this service must be valid service interface with
public static final SERVICE_NAME declaration.
|
protected TopiaService |
getService(String name) |
protected <E extends TopiaService> |
getServiceName(Class<E> interfaceService)
Retrieve service name using SERVICE_NAME static field on service
interface.
|
Map<String,TopiaService> |
getServices()
The list of registered services.
|
TopiaIdFactory |
getTopiaIdFactory()
Get the currently configured
TopiaIdFactory. |
protected void |
initTopiaIdFactory() |
boolean |
isClosed()
Tells if the context is closed
|
boolean |
isSchemaEmpty() |
boolean |
isSchemaExist(Class<?> clazz)
Detect if the table is created on storage for a given persistant class.
|
boolean |
isTableExists(Class<?> clazz) |
protected Map<String,TopiaService> |
loadServices(Properties config) |
protected void |
postInitServices(Map<String,TopiaService> services) |
protected void |
preInitServices(Map<String,TopiaService> services) |
protected org.hibernate.Query |
prepareQuery(String jpaql,
Map<String,Object> parameters) |
void |
removeChildContext(TopiaContext child) |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Unregister the given PropertyChangeListener about some entity's
property change from the context
|
void |
removeTopiaContextListener(TopiaContextListener listener)
Deprecated.
|
void |
removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable)
Unregister the given TopiaEntitiesVetoable about any TopiaEntity from the
context
|
void |
removeTopiaEntityListener(Class<? extends TopiaEntity> entityClass,
TopiaEntityListener listener)
Unregister the given TopiaEntityListener about the given entity class
from the context
|
void |
removeTopiaEntityListener(TopiaEntityListener listener)
Unregister the given TopiaEntityListener about any TopiaEntity from the
context
|
void |
removeTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass,
TopiaEntityVetoable vetoable)
Unregister the given TopiaEntityVetoable about the given entity class
from the context
|
void |
removeTopiaEntityVetoable(TopiaEntityVetoable vetoable)
Unregister the given TopiaEntityVetoable about any TopiaEntity from the
context
|
void |
removeTopiaSchemaListener(TopiaSchemaListener listener)
Unregister the given TopiaSchemaListener about any schema modification
from the context
|
void |
removeTopiaTransactionListener(TopiaTransactionListener listener)
Unregister the given TopiaTransactionListener about the transaction from
the context
|
void |
removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable)
Unregister the given TopiaTransactionVetoable about the transaction from
the context
|
void |
replicate(TopiaContext dstCtxt,
Object... entityAndCondition)
Makes a replication of some entities from this context to the given
context without any entity modification.
|
void |
replicate(TopiaEntity entity)
Must replicate given entity in current database
|
void |
replicate(TopiaReplicationDestination topiaReplicationDestination,
Object... entityAndCondition)
Makes a replication of some entities from this context to the given
context without any entity modification.
|
protected void |
replicate0(AbstractTopiaContext dstContextImpl,
Object... entities) |
<T extends TopiaEntity> |
replicateEntities(TopiaContext dstCtxt,
List<T> entities)
Makes a replication of some entities from this context to the given
context without any entity modification.
|
<T extends TopiaEntity> |
replicateEntities(TopiaReplicationDestination topiaReplicationDestination,
List<T> entities)
Makes a replication of some entities from this context to the given
context without any entity modification.
|
<T extends TopiaEntity> |
replicateEntity(TopiaContext dstCtxt,
T entity)
Replicate a given entity from this context to the given context.
|
<T extends TopiaEntity> |
replicateEntity(TopiaReplicationDestination topiaReplicationDestination,
T entity)
Replicate a given entity from this context to the given context.
|
void |
restore(File file)
Read database from gzip compressed file
Only work for h2 database
|
void |
rollbackTransaction()
Cancels all the modifications made to this context, coming back to the
state on the last beginTransaction.
|
<E extends TopiaService> |
serviceEnabled(Class<E> interfaceService)
Return true if specific service is available.
|
protected boolean |
serviceEnabled(String name) |
void |
setUseFlushMode(boolean useFlushMode)
Change the value of flag
useFlushMode. |
void |
showCreateSchema()
Displays the SQL queries that would be used for a schema creation
|
void |
update(TopiaEntity entity)
Add into this TopiaContext an entity created by another TopiaContext
|
void |
updateSchema()
Triggers database schema update
|
@Deprecated protected TopiaContextImplementor parentContext
protected org.hibernate.cfg.Configuration hibernateConfiguration
protected org.hibernate.SessionFactory hibernateFactory
protected org.hibernate.Session hibernate
protected boolean closed
protected boolean useFlushMode
true), in that case whebn doing queries (says in method
findAll(String, Object...) or find(String, int, int, Object...))
it will use the flush mode FlushMode.AUTO).
But sometimes, when doing a lot of queries (for some imports for example),
we do NOT want the session to be flushed each time we do a find, then you
can set this flag to false using the method setUseFlushMode(boolean)protected Properties config
protected TopiaIdFactory topiaIdFactory
protected Map<Class<? extends TopiaEntity>,TopiaDAO<? extends TopiaEntity>> daoCache
protected final Set<TopiaContextImplementor> childContext
beginTransaction(). We are
listener on these context. A WeakHashMap is used to remove old context
automically when it's not used anymore. The finalize() method will
be executed when Garbage collector is called when reference is removed.
The set is synchronized in case of using multi-threading.protected Map<String,TopiaService> services
protected TopiaFiresSupport firesSupport
protected AbstractTopiaContext()
public AbstractTopiaContext(Properties config) throws TopiaNotFoundException
TopiaContextFactory to initialize rootContext
using config.config - for the new root contextTopiaNotFoundException - if one of persistent class from
configuration is not foundprotected AbstractTopiaContext(TopiaContextImplementor parentContext)
beginTransaction() to instantiate child from
parentContext.parentContext - context parent of the new TopiaContext childprotected void initTopiaIdFactory()
protected Map<String,TopiaService> loadServices(Properties config)
protected void preInitServices(Map<String,TopiaService> services)
protected void postInitServices(Map<String,TopiaService> services)
protected TopiaService getService(String name)
protected boolean serviceEnabled(String name)
protected <E extends TopiaService> String getServiceName(Class<E> interfaceService) throws IllegalAccessException, NoSuchFieldException
E - type of the service that extends TopiaServiceinterfaceService - class of the serviceIllegalAccessException - if field SERVICE_NAME can't be accessedNoSuchFieldException - if no field SERVICE_NAME is definedpublic Map<String,TopiaService> getServices()
TopiaServiceSupportgetServices in interface TopiaContextImplementorgetServices in interface TopiaServiceSupportpublic <E extends TopiaService> E getService(Class<E> interfaceService) throws TopiaNotFoundException
getService in interface TopiaContextgetService in interface TopiaServiceSupportE - type of the service that extends TopiaServiceinterfaceService - class of the serviceTopiaNotFoundException - if an error appears or service not found.getServiceName(Class)public <E extends TopiaService> boolean serviceEnabled(Class<E> interfaceService)
TopiaContextserviceEnabled in interface TopiaContextserviceEnabled in interface TopiaServiceSupportE - type of serviceinterfaceService - fqn of the servicepublic Set<TopiaContextImplementor> getChildContext()
TopiaContextImplementorgetChildContext in interface TopiaContextImplementorprotected void addChildContext(TopiaContextImplementor child)
public void removeChildContext(TopiaContext child)
removeChildContext in interface TopiaContextImplementorpublic TopiaContextImplementor getParentContext()
getParentContext in interface TopiaContextImplementorpublic TopiaContextImplementor getRootContext()
getRootContext in interface TopiaContextImplementorpublic Properties getConfig()
getConfig in interface TopiaContextImplementorpublic TopiaIdFactory getTopiaIdFactory()
TopiaPersistenceContextTopiaIdFactory.getTopiaIdFactory in interface TopiaPersistenceContextTopiaIdFactory in useTopiaIdFactory}public void setUseFlushMode(boolean useFlushMode)
useFlushMode.setUseFlushMode in interface TopiaContextImplementorsetUseFlushMode in interface TopiaJpaSupportuseFlushMode - the new value to setuseFlushModepublic void createSchema()
throws TopiaException
TopiaContextcreateSchema in interface TopiaContextTopiaException - if any exceptionpublic void showCreateSchema()
throws TopiaException
TopiaContextshowCreateSchema in interface TopiaContextTopiaException - if any exceptionpublic void updateSchema()
throws TopiaException
TopiaContextupdateSchema in interface TopiaContextTopiaException - if any exceptionpublic void dropSchema()
throws TopiaException
TopiaExceptionpublic org.hibernate.Session getHibernate()
throws TopiaException
getHibernate in interface TopiaContextImplementorTopiaException - si aucune transaction n'est ouvertepublic org.hibernate.SessionFactory getHibernateFactory()
getHibernateFactory in interface TopiaContextImplementorgetHibernateFactory in interface TopiaHibernateSupportpublic org.hibernate.cfg.Configuration getHibernateConfiguration()
getHibernateConfiguration in interface TopiaContextImplementorgetHibernateConfiguration in interface TopiaHibernateSupportpublic <E extends TopiaEntity> TopiaDAO<E> getDao(Class<E> entityClass) throws TopiaException
TopiaDaoSuppliergetDao in interface TopiaContextImplementorgetDao in interface TopiaDaoSupplierE - type of entityentityClass - type of entityTopiaException - if any errorpublic <E extends TopiaEntity,D extends TopiaDAO<E>> D getDao(Class<E> entityClass, Class<D> daoClass) throws TopiaException
TopiaDaoSuppliergetDao in interface TopiaContextImplementorgetDao in interface TopiaDaoSupplierE - type of entityentityClass - type of entitydaoClass - the concrete dao class to useTopiaException - if any errorpublic TopiaContext beginTransaction() throws TopiaException
TopiaContextbeginTransaction in interface TopiaContextTopiaException - if any exceptionpublic void commitTransaction()
throws TopiaException
TopiaContextcommitTransaction in interface TopiaContextcommitTransaction in interface TopiaTransactionTopiaException - if any exceptionpublic void rollbackTransaction()
throws TopiaException
TopiaContextrollbackTransaction in interface TopiaContextrollbackTransaction in interface TopiaTransactionTopiaException - if any exceptionpublic void closeContext()
throws TopiaException
TopiaContextcloseContext in interface TopiaContextcloseContext in interface TopiaPersistenceContextTopiaException - if any exceptionprotected void finalize()
throws Throwable
public boolean isClosed()
TopiaContextisClosed in interface TopiaContextisClosed in interface TopiaPersistenceContexttrue if the context is closed, false otherwisepublic void executeSQL(String sqlScript) throws TopiaException
TopiaContextexecuteSQL in interface TopiaContextexecuteSQL in interface TopiaSqlSupportsqlScript - the sql script to executeTopiaException - if any problem occurred while executing the sql script.protected void checkClosed(String message) throws TopiaException
TopiaExceptionpublic <E extends TopiaEntity> E findByTopiaId(String id) throws TopiaException
TopiaContextTopiaEntity using its unique id.findByTopiaId in interface TopiaContextfindByTopiaId in interface TopiaPersistenceContextid - unique identifier of the entity in all the application.TopiaException - for errors on retrieving the entitypublic <E> List<E> findAll(String jpaql, Object... propertyNamesAndValues) throws TopiaException
TopiaContextfindAll in interface TopiaContextfindAll in interface TopiaJpaSupportjpaql - the HQL querypropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - for any error during queryingpublic <E> List<E> find(String jpaql, int startIndex, int endIndex, Object... propertyNamesAndValues) throws TopiaException
TopiaContextstartIndex = 0.endIndex = -1.
WARNING : Depending on the registered service, this method may not
support something else than queries on TopiaEntityfind in interface TopiaContextfind in interface TopiaJpaSupportjpaql - 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 - for any error during queryingpublic <E> E findUnique(String jpaql, Object... propertyNamesAndValues) throws TopiaException
TopiaContextfindUnique in interface TopiaContextfindUnique in interface TopiaJpaSupportjpaql - the HQL querypropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - for any error during querying or if the the query
returns more than one result.public int execute(String jpaql, Object... propertyNamesAndValues) throws TopiaException
execute in interface TopiaContextexecute in interface TopiaJpaSupportjpaql - HQL querypropertyNamesAndValues - arguments for queryTopiaExceptionprotected org.hibernate.Query prepareQuery(String jpaql, Map<String,Object> parameters)
public <T> List<T> findAll(String jpaql, Map<String,Object> parameters)
TopiaJpaSupportfindAll in interface TopiaJpaSupportjpaql - the JPA-QL queryparameters - a map which keys are the attribute names and values are the attributes expected valuespublic <T> List<T> find(String jpaql, int startIndex, int endIndex, Map<String,Object> parameters)
TopiaJpaSupportstartIndex = 0.endIndex = -1.
WARNING : Depending on the registered service, this method may not
support something else than queries on TopiaEntityfind in interface TopiaJpaSupportjpaql - the JPA-QL querystartIndex - first index of entity to returnendIndex - last index of entity to returnparameters - a map which keys are the attribute names and values are the attributes expected valuespublic <T> T findUnique(String jpaql, Map<String,Object> parameters)
TopiaJpaSupportfindUnique in interface TopiaJpaSupportjpaql - the JPA-QL queryparameters - a map which keys are the attribute names and values are the attributes expected valuespublic int execute(String jpaql, Map<String,Object> parameters)
TopiaJpaSupportexecute in interface TopiaJpaSupportjpaql - the JPA-QL queryparameters - a map which keys are the attribute names and values are the attributes expected valuespublic void add(TopiaEntity e) throws TopiaException
TopiaContextadd in interface TopiaContexte - the entity to addTopiaException - if any exceptionpublic void replicate(TopiaContext dstCtxt, Object... entityAndCondition) throws TopiaException, IllegalArgumentException
TopiaContextentityAndCondition parameter is empty,
all the database will be replicated
Note 2: The simple replication may not be sufficent. You may want
to replicate only a part of some entities : use the method TopiaContext.replicateEntities(TopiaContext, List).replicate in interface TopiaContextdstCtxt - the destination contextentityAndCondition - [key;value;...] parameter which key is the
entity class to replicate, and value the
"where" condition to use when querying entitiesTopiaException - if any problem occurred during replicateIllegalArgumentException - if one of the context is closed or if
trying to replicate within the same
databasepublic <T extends TopiaEntity> void replicateEntity(TopiaContext dstCtxt, T entity) throws TopiaException, IllegalArgumentException
TopiaContextreplicateEntity in interface TopiaContextT - type of the entity to replicatedstCtxt - the destination contextentity - the entity instance to replicateTopiaException - if any problem occurred during replicateIllegalArgumentException - if one of the context is closed or if
trying to replicate within the same
databasepublic <T extends TopiaEntity> void replicateEntities(TopiaContext dstCtxt, List<T> entities) throws TopiaException, IllegalArgumentException
TopiaContextreplicateEntities in interface TopiaContextT - type of the entities to replicatedstCtxt - the destination contextentities - the list of entities instance to replicateTopiaException - if any problem occurred during replicateIllegalArgumentException - if one of the context is closed or if
trying to replicate within the same
databasepublic void replicate(TopiaEntity entity)
TopiaReplicationDestinationreplicate in interface TopiaReplicationDestinationpublic void replicate(TopiaReplicationDestination topiaReplicationDestination, Object... entityAndCondition) throws IllegalArgumentException
TopiaReplicationSupportentityAndCondition parameter is empty,
all the database will be replicated
Note 2: The simple replication may not be sufficent. You may want
to replicate only a part of some entities : use the method TopiaReplicationSupport.replicateEntities(TopiaReplicationDestination, java.util.List).replicate in interface TopiaReplicationSupporttopiaReplicationDestination - the destination contextentityAndCondition - [key;value;...] parameter which key is the
entity class to replicate, and value the
"where" condition to use when querying entitiesIllegalArgumentException - if one of the context is closed or if
trying to replicate within the same
databasepublic <T extends TopiaEntity> void replicateEntity(TopiaReplicationDestination topiaReplicationDestination, T entity) throws IllegalArgumentException
TopiaReplicationSupportreplicateEntity in interface TopiaReplicationSupporttopiaReplicationDestination - the destination contextentity - the entity instance to replicateIllegalArgumentException - if one of the context is closed or if
trying to replicate within the same
databasepublic <T extends TopiaEntity> void replicateEntities(TopiaReplicationDestination topiaReplicationDestination, List<T> entities) throws IllegalArgumentException
TopiaReplicationSupportreplicateEntities in interface TopiaReplicationSupporttopiaReplicationDestination - the destination contextentities - the list of entities instance to replicateIllegalArgumentException - if one of the context is closed or if
trying to replicate within the same
databasepublic TopiaFiresSupport getFiresSupport()
getFiresSupport in interface TopiaContextImplementorpublic void backup(File file, boolean compress) throws TopiaException
backup in interface TopiaContextfile - file to write backupcompress - if true then use gzip to compress fileTopiaException - if any exceptionTopiaContext.backup(File, boolean)public void restore(File file) throws TopiaException
restore in interface TopiaContextfile - le fichier ou prendre les informations, il peut-etre
compressé avec gzip ou non.TopiaException - if any exceptionTopiaContext.restore(File)public void clear(boolean dropDatabase)
throws TopiaException
clear in interface TopiaContextdropDatabase - 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 exceptionTopiaContext.clear(boolean)public void clearCache()
throws TopiaException
clearCache in interface TopiaContextTopiaExceptionpublic List<Class<?>> getPersistenceClasses()
getPersistenceClasses in interface TopiaContextImplementorpublic boolean isSchemaExist(Class<?> clazz) throws TopiaException
TopiaContextImplementorisSchemaExist in interface TopiaContextImplementorclazz - the researched classTopiaException - si aucune transaction n'est ouvertepublic boolean isSchemaEmpty()
public boolean isTableExists(Class<?> clazz)
public String getSchemaName()
public void addTopiaEntityListener(TopiaEntityListener listener)
TopiaContextlistener instance will be notified AFTER any operation on
the entity.addTopiaEntityListener in interface TopiaContextaddTopiaEntityListener in interface TopiaListenableSupportlistener - the listener instance to registerpublic void addTopiaEntityListener(Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener)
TopiaContextlistener instance will be notified AFTER any
operation on the entity.addTopiaEntityListener in interface TopiaContextaddTopiaEntityListener in interface TopiaListenableSupportentityClass - the TopiaEntity's class to listenlistener - the listener instance to registerpublic void addTopiaEntityVetoable(TopiaEntityVetoable vetoable)
TopiaContextvetoable instance will be notified BEFORE any operation on
the entity.addTopiaEntityVetoable in interface TopiaContextaddTopiaEntityVetoable in interface TopiaListenableSupportvetoable - the vetoable instance to registerpublic void addTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable)
TopiaContextvetoable instance will be notified BEFORE any
operation on the entity.addTopiaEntityVetoable in interface TopiaContextaddTopiaEntityVetoable in interface TopiaListenableSupportentityClass - the TopiaEntity's class to listenvetoable - the vetoable instance to registerpublic void addTopiaTransactionListener(TopiaTransactionListener listener)
TopiaContextlistener instance will be notified AFTER any operation on
the transaction.addTopiaTransactionListener in interface TopiaContextaddTopiaTransactionListener in interface TopiaListenableSupportlistener - the listener instance to registerpublic void addTopiaTransactionVetoable(TopiaTransactionVetoable vetoable)
TopiaContextvetoable instance will be notified BEFORE any operation on
the transaction.addTopiaTransactionVetoable in interface TopiaContextaddTopiaTransactionVetoable in interface TopiaListenableSupportvetoable - the vetoable instance to registerpublic void addPropertyChangeListener(PropertyChangeListener listener)
TopiaContextlistener instance will be notified AFTER
any change on the entity's propertyaddPropertyChangeListener in interface TopiaContextaddPropertyChangeListener in interface TopiaListenableSupportlistener - the listener instance to register@Deprecated public void addTopiaContextListener(TopiaContextListener listener)
TopiaContextlistener instance will be notified BEFORE and
AFTER any change on the schemaaddTopiaContextListener in interface TopiaContextlistener - the listener instance to registerpublic void addTopiaSchemaListener(TopiaSchemaListener listener)
TopiaListenableSupportlistener instance will be notified BEFORE and
AFTER any change on the schemaaddTopiaSchemaListener in interface TopiaListenableSupportlistener - the listener instance to registerpublic void removeTopiaEntityListener(TopiaEntityListener listener)
TopiaContextremoveTopiaEntityListener in interface TopiaContextremoveTopiaEntityListener in interface TopiaListenableSupportlistener - the listener instance to unregisterpublic void removeTopiaEntityListener(Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener)
TopiaContextremoveTopiaEntityListener in interface TopiaContextremoveTopiaEntityListener in interface TopiaListenableSupportentityClass - the listened TopiaEntity's classlistener - the listener instance to unregisterpublic void removeTopiaEntityVetoable(TopiaEntityVetoable vetoable)
TopiaContextremoveTopiaEntityVetoable in interface TopiaContextremoveTopiaEntityVetoable in interface TopiaListenableSupportvetoable - the vetoable instance to unregisterpublic void removeTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable)
TopiaContextremoveTopiaEntityVetoable in interface TopiaContextremoveTopiaEntityVetoable in interface TopiaListenableSupportentityClass - the listened TopiaEntity's classvetoable - the vetoable instance to unregisterpublic void removeTopiaTransactionListener(TopiaTransactionListener listener)
TopiaContextremoveTopiaTransactionListener in interface TopiaContextremoveTopiaTransactionListener in interface TopiaListenableSupportlistener - the listener instance to unregisterpublic void removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable)
TopiaContextremoveTopiaTransactionVetoable in interface TopiaContextremoveTopiaTransactionVetoable in interface TopiaListenableSupportvetoable - the vetoable instance to unregisterpublic void removePropertyChangeListener(PropertyChangeListener listener)
TopiaContextremovePropertyChangeListener in interface TopiaContextremovePropertyChangeListener in interface TopiaListenableSupportlistener - the listener instance to unregister@Deprecated public void removeTopiaContextListener(TopiaContextListener listener)
TopiaContextremoveTopiaContextListener in interface TopiaContextlistener - the listener instance to unregisterpublic void removeTopiaSchemaListener(TopiaSchemaListener listener)
TopiaListenableSupportremoveTopiaSchemaListener in interface TopiaListenableSupportlistener - the listener instance to unregisterpublic void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable)
TopiaContextvetoable instance will be notified BEFORE any entity loadaddTopiaEntitiesVetoable in interface TopiaContextaddTopiaEntitiesVetoable in interface TopiaListenableSupportvetoable - the vetoable instance to registerpublic void removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable)
TopiaContextremoveTopiaEntitiesVetoable in interface TopiaContextremoveTopiaEntitiesVetoable in interface TopiaListenableSupportvetoable - the vetoable instance to unregisterprotected String[] buildQueries(Object... entityAndCondition) throws TopiaException, IllegalArgumentException
entityAndCondition.
If no parameter is given, then build the queries for all entities is db,
with no condition.entityAndCondition - the list of tuples (Class,String)TopiaException - if any pb of db while getting entities
classes.IllegalArgumentException - if any pb with the given parameter
(mainly ClassCastException).protected void replicate0(AbstractTopiaContext dstContextImpl, Object... entities) throws TopiaException
TopiaExceptionpublic org.hibernate.Session getHibernateSession()
throws TopiaException
getHibernateSession in interface TopiaHibernateSupportTopiaExceptionpublic void update(TopiaEntity entity) throws TopiaException
TopiaPersistenceContextupdate in interface TopiaPersistenceContextentity - the entity to addTopiaExceptionCopyright © 2004–2013 CodeLutin. All rights reserved.