public interface TopiaContext
TopiaContextFactory.getContext(java.util.Properties)
Created: 3 janv. 2006 21:18:34| Modifier and Type | Method and Description |
|---|---|
void |
add(TopiaEntity e)
Add into this TopiaContext an entity created by another TopiaContext
|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Register to the context a PropertyChangeListener about some entity's
property change.
|
void |
addTopiaContextListener(TopiaContextListener listener)
Deprecated.
Use addTopiaSchemaListener
|
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)
Deprecated.
Only H2 compatible : remove it, or move to another class
|
TopiaContext |
beginTransaction()
Returns a new context containing its own transaction.
|
void |
clear(boolean dropDatabase)
Deprecated.
Only H2 compatible : remove it, or move to another class
|
void |
clearCache()
Clear persistence implementation cache.
|
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()
Triggers database schema drop
|
void |
evict(TopiaEntity e)
Detaches the given entity from the session
|
int |
execute(String hql,
Object... propertyNamesAndValues)
Execute HQL operation on data (Update, Delete).
|
void |
executeSQL(String sqlScript)
Execute a given sql code inside this transaction.
|
<E> List<E> |
find(String hql,
int startIndex,
int endIndex,
Object... propertyNamesAndValues)
Allow to do some JPA-QL query using the given bounds.
|
<E> List<E> |
findAll(String hql,
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 topiaId)
Retrieve
TopiaEntity using its unique id. |
<E> E |
findUnique(String hql,
Object... propertyNamesAndValues)
Allow to do some HQL query and return an unique result.
|
<E extends TopiaService> |
getService(Class<E> interfaceService)
Return the service.
|
boolean |
isClosed()
Tells if the context is closed
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Unregister the given PropertyChangeListener about some entity's
property change from the context
|
void |
removeTopiaContextListener(TopiaContextListener listener)
Deprecated.
Use removeTopiaSchemaListener
|
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 destinationContext,
Object... entityAndCondition)
Makes a replication of some entities from this context to the given
context without any entity modification.
|
<T extends TopiaEntity> |
replicateEntities(TopiaContext destinationContext,
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 destinationContext,
T entity)
Replicate a given entity from this context to the given context.
|
void |
restore(File file)
Deprecated.
Only H2 compatible : remove it, or move to another class
|
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.
|
void |
showCreateSchema()
Displays the SQL queries that would be used for a schema creation
|
void |
updateSchema()
Triggers database schema update
|
TopiaContext beginTransaction() throws TopiaException
TopiaException - if any exceptionvoid commitTransaction()
throws TopiaException
TopiaException - if any exceptionvoid rollbackTransaction()
throws TopiaException
TopiaException - if any exceptionvoid closeContext()
throws TopiaException
TopiaException - if any exceptionboolean isClosed()
true if the context is closed, false otherwisevoid addTopiaEntityListener(TopiaEntityListener listener)
listener instance will be notified AFTER any operation on
the entity.listener - the listener instance to registervoid addTopiaEntityListener(Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener)
listener instance will be notified AFTER any
operation on the entity.entityClass - the TopiaEntity's class to listenlistener - the listener instance to registervoid removeTopiaEntityListener(TopiaEntityListener listener)
listener - the listener instance to unregistervoid removeTopiaEntityListener(Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener)
entityClass - the listened TopiaEntity's classlistener - the listener instance to unregistervoid addTopiaEntityVetoable(TopiaEntityVetoable vetoable)
vetoable instance will be notified BEFORE any operation on
the entity.vetoable - the vetoable instance to registervoid addTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable)
vetoable instance will be notified BEFORE any
operation on the entity.entityClass - the TopiaEntity's class to listenvetoable - the vetoable instance to registervoid removeTopiaEntityVetoable(TopiaEntityVetoable vetoable)
vetoable - the vetoable instance to unregistervoid removeTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable)
entityClass - the listened TopiaEntity's classvetoable - the vetoable instance to unregistervoid addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable)
vetoable instance will be notified BEFORE any entity loadvetoable - the vetoable instance to registervoid removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable)
vetoable - the vetoable instance to unregistervoid addTopiaTransactionListener(TopiaTransactionListener listener)
listener instance will be notified AFTER any operation on
the transaction.listener - the listener instance to registervoid removeTopiaTransactionListener(TopiaTransactionListener listener)
listener - the listener instance to unregistervoid addTopiaTransactionVetoable(TopiaTransactionVetoable vetoable)
vetoable instance will be notified BEFORE any operation on
the transaction.vetoable - the vetoable instance to registervoid removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable)
vetoable - the vetoable instance to unregistervoid addPropertyChangeListener(PropertyChangeListener listener)
listener instance will be notified AFTER
any change on the entity's propertylistener - the listener instance to registervoid removePropertyChangeListener(PropertyChangeListener listener)
listener - the listener instance to unregistervoid addTopiaSchemaListener(TopiaSchemaListener listener)
listener instance will be notified BEFORE and
AFTER any change on the schemalistener - the listener instance to registervoid removeTopiaSchemaListener(TopiaSchemaListener listener)
listener - the listener instance to unregister@Deprecated void addTopiaContextListener(TopiaContextListener listener)
listener instance will be notified BEFORE and
AFTER any change on the schemalistener - the listener instance to register@Deprecated void removeTopiaContextListener(TopiaContextListener listener)
listener - the listener instance to unregister<E extends TopiaEntity> E 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<E> List<E> findAll(String hql, Object... propertyNamesAndValues) throws TopiaException
hql - the HQL querypropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - for any error during querying<E> List<E> find(String hql, int startIndex, int endIndex, Object... propertyNamesAndValues) throws TopiaException
startIndex = 0.endIndex = -1.
WARNING : Depending on the registered service, this method may not
support something else than queries on TopiaEntityhql - 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 querying<E> E findUnique(String hql, Object... propertyNamesAndValues) throws TopiaException
hql - 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.void add(TopiaEntity e) throws TopiaException
e - the entity to addTopiaException - if any exceptionvoid evict(TopiaEntity e) throws TopiaException
e - the entity to detachTopiaException - if any exceptionvoid clearCache()
throws TopiaException
TopiaExceptionint execute(String hql, Object... propertyNamesAndValues) throws TopiaException
hql - the HQL querypropertyNamesAndValues - the query parameters. Arguments are key-value paired :
[propertyName;value;propertyName;value;...]TopiaException - if any exceptionvoid executeSQL(String sqlScript) throws TopiaException
sqlScript - the sql script to executeTopiaException - if any problem occurred while executing the sql script.void createSchema()
throws TopiaException
TopiaException - if any exceptionvoid showCreateSchema()
throws TopiaException
TopiaException - if any exceptionvoid updateSchema()
throws TopiaException
TopiaException - if any exceptionvoid dropSchema()
throws TopiaException
TopiaException - if any exception<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 replicate(TopiaContext destinationContext, Object... entityAndCondition) throws TopiaException, IllegalArgumentException
entityAndCondition 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 replicateEntities(TopiaContext, List).destinationContext - 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
database<T extends TopiaEntity> void replicateEntity(TopiaContext destinationContext, T entity) throws TopiaException, IllegalArgumentException
T - type of the entity to replicatedestinationContext - 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
database<T extends TopiaEntity> void replicateEntities(TopiaContext destinationContext, List<T> entities) throws TopiaException, IllegalArgumentException
T - type of the entities to replicatedestinationContext - 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
database@Deprecated 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 exception@Deprecated void 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 exception@Deprecated void 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 exceptionCopyright © 2004–2013 CodeLutin. All rights reserved.