public class TopiaUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TopiaUtil.ConnectionProviderSupplier
Hibernate 4.3.x compatible
Supplier<ConnectionProvider>. |
| Constructor and Description |
|---|
TopiaUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Map<String,Object> |
convertPropertiesArrayToMap(Object... propertyNamesAndValues) |
static Map<String,Object> |
convertPropertiesArrayToMap(String propertyName,
Object propertyValue,
Object... otherPropertyNamesAndValues) |
static Properties |
getProperties(Properties parent,
String pathOrUrl)
Permet de récupérer le fichier de propriété ayant le nom passé en
argument.
|
static Properties |
getProperties(String pathOrUrl)
Permet de récupérer le fichier de propriété ayant le nom passé en
argument.
|
static String |
getSchemaName(org.hibernate.cfg.Configuration config)
Return hibernate schema name
|
static String |
getTopiaIdPattern(Class<? extends TopiaEntity> klass)
Compute the pattern to be used to capture a topia id for a given entity
class.
|
static Pattern |
getTopiaPattern(String format,
Class<? extends TopiaEntity>... classes)
Compute a regex pattern given a format string.
|
static boolean |
isSchemaEmpty(org.hibernate.cfg.Configuration configuration,
org.hibernate.boot.Metadata metaData)
Test if the db associated to the given
configuration contains any of
the dealed entities. |
static boolean |
isSchemaEmpty(TopiaHibernateSupport topiaHibernateSupport)
Test if the db associated to the given
configuration contains any of
the dealed entities. |
static boolean |
isSchemaExist(org.hibernate.cfg.Configuration configuration,
org.hibernate.boot.Metadata metadata,
String entityName)
Test si une entite donnee correspondant a une configuration existe en
base.
|
static boolean |
isSchemaExist(TopiaHibernateSupport topiaHibernateSupport,
String entityName)
Test si une entité donnée correspondant a une configuration existe en
base.
|
static org.hibernate.SessionFactory |
newSessionFactory(org.hibernate.cfg.Configuration hibernateConfiguration)
Builds a new instance of Hibernate SessionFactory according to the given Hibernate Configuration
|
static <V> V |
runInSession(org.hibernate.cfg.Configuration configuration,
com.google.common.base.Function<org.hibernate.Session,V> function)
Apply the given Function in a Hibernate transaction.
|
static void |
warnOnAutomaticSchemaOperationRisk(org.hibernate.cfg.Configuration configuration) |
public static Properties getProperties(String pathOrUrl) throws TopiaNotFoundException
pathOrUrl - le nom du fichier de propriété à charger, s'il est null
ou vide retourne un objet Properties vide.TopiaNotFoundException - Si pathOrUrl n'est pas null ou vide et que
le fichier devant contenir les propriétés
n'est pas retrouvé.public static Properties getProperties(Properties parent, String pathOrUrl) throws TopiaNotFoundException
parent - l'objet properties utilisé comme parent de l'objet
retournépathOrUrl - le nom du fichier de propriété à charger, s'il est null
ou vide retourne un objet Properties vide.TopiaNotFoundException - Si pathOrUrl n'est pas null ou vide et que
le fichier devant contenir les propriétés
n'est pas retrouvé.public static Pattern getTopiaPattern(String format, Class<? extends TopiaEntity>... classes)
String.format(String, Object...) will be apply to
format, with for parameters the list of klass
transformed in topia pattern via method getTopiaIdPattern(Class)
ready to be capture (enclosed by ()).format - the formatclasses - the list of class to usepublic static String getTopiaIdPattern(Class<? extends TopiaEntity> klass)
klass - the entity classpublic static boolean isSchemaExist(TopiaHibernateSupport topiaHibernateSupport, String entityName)
topiaHibernateSupport - the Hibernate support required for this operationentityName - le nom de l'entite a testerpublic static boolean isSchemaExist(org.hibernate.cfg.Configuration configuration,
org.hibernate.boot.Metadata metadata,
String entityName)
configuration - la configuration hibernateentityName - le nom de l'entite a testerpublic static void warnOnAutomaticSchemaOperationRisk(org.hibernate.cfg.Configuration configuration)
public static boolean isSchemaEmpty(org.hibernate.cfg.Configuration configuration,
org.hibernate.boot.Metadata metaData)
configuration contains any of
the dealed entities.configuration - hibernate db configurationmetaData - hibernate metadatatrue if there is no schema for any of the dealed entities,
false otherwise.public static boolean isSchemaEmpty(TopiaHibernateSupport topiaHibernateSupport)
configuration contains any of
the dealed entities.topiaHibernateSupport - the Hibernate support required for this operationtrue if there is no schema for any of the dealed entities,
false otherwise.public static String getSchemaName(org.hibernate.cfg.Configuration config)
config - of hibernatepublic static Map<String,Object> convertPropertiesArrayToMap(Object... propertyNamesAndValues) throws IllegalArgumentException
IllegalArgumentExceptionpublic static Map<String,Object> convertPropertiesArrayToMap(String propertyName, Object propertyValue, Object... otherPropertyNamesAndValues) throws IllegalArgumentException
IllegalArgumentExceptionpublic static org.hibernate.SessionFactory newSessionFactory(org.hibernate.cfg.Configuration hibernateConfiguration)
hibernateConfiguration - an initialized Hibernate Configurationpublic static <V> V runInSession(org.hibernate.cfg.Configuration configuration,
com.google.common.base.Function<org.hibernate.Session,V> function)
V - the return type, match the functionconfiguration - an initialized Hibernate Configurationfunction - the function to run using a valid Hibernate SessionCopyright © 2004–2019 CodeLutin. All rights reserved.