Class DBMapping
java.lang.Object
org.nuiton.topia.persistence.legacy.DBMapping
Une classe qui permet d'obtenir les mapping de noms entre les entités et les objets de la base.
On retrouve aussi ici des méthodes utils pour executer du code sql sur la base (notamment la gestion des séquences).
- Author:
- Tony Chemit - chemit@codelutin.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final org.apache.commons.logging.Loglogprotected static final Stringprotected Stringprotected static final Stringprotected static final Stringprotected Map<String,Class<? extends TopiaEntity>> protected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcheckSequence(Class<? extends TopiaEntity> entityClass, String propertyName) protected StringcheckSequence(String sequenceKey) voidclose()voidcreateSequence(Class<? extends TopiaEntity> entityClass, String propertyName, TopiaSqlSupport ctxt) voidcreateSequence(String sequenceKey, TopiaSqlSupport ctxt) voidcreateSequence(String sequenceKey, TopiaSqlSupport ctxt, boolean check) voidprotected voiddoSQLWork(TopiaSqlSupport sqlSupport, String sql) booleanexistSequence(Class<? extends TopiaEntity> entityClass, String propertyName, TopiaSqlSupport ctxt) booleanexistSequence(String sequenceKey, TopiaSqlSupport ctxt) booleanexistSequence(String sequenceKey, TopiaSqlSupport ctxt, boolean check) protected voidfinalize()protected BigIntegergetBigInteger(TopiaSqlSupport sqlSupport, String sql, BigInteger defaultSize) protected abstract Class<? extends TopiaEntity>getContractClass(Class<? extends TopiaEntity> entityClass) getCurrentValueFromSequence(Class<? extends TopiaEntity> entityClass, String propertyName, TopiaSqlSupport ctxt) getCurrentValueFromSequence(String sequenceKey, TopiaSqlSupport ctxt) getCurrentValueFromSequence(String sequenceKey, TopiaSqlSupport ctxt, boolean check) protected StringgetDBProperty(Class<? extends TopiaEntity> entityClass, String property) protected StringgetDBTable(Class<? extends TopiaEntity> entityClass) getNextValueFromSequence(Class<? extends TopiaEntity> entityClass, String propertyName, TopiaSqlSupport ctxt) getNextValueFromSequence(String sequenceKey, TopiaSqlSupport ctxt) getNextValueFromSequence(String sequenceKey, TopiaSqlSupport ctxt, boolean check) protected StringgetSequencePropertyName(String sequenceKey) protected StringgetSequenceSQL(String pattern, Class<? extends TopiaEntity> entityClass, String propertyName) protected StringgetSequenceSQL(String pattern, String sequenceKey) voidinit(TopiaApplicationContext ctxt, boolean doCreate, boolean doUpdate) protected voidinitMapping(Properties props) voidupdateSequence(Class<? extends TopiaEntity> entityClass, String propertyName, TopiaSqlSupport ctxt) voidupdateSequence(String sequenceKey, TopiaSqlSupport ctxt) voidupdateSequence(String sequenceKey, TopiaSqlSupport sqlSupport, boolean check) void
-
Field Details
-
log
protected static final org.apache.commons.logging.Log loglog -
CLASS_PATTERN
- See Also:
-
DBNAME_ATTRIBUTE_PATTERN
- See Also:
-
SEQUENCE_ATTRIBUTE_PATTERN
- See Also:
-
CREATE_SEQUENCE_FORMAT
- See Also:
-
UPDATE_SEQUENCE_FORMAT
- See Also:
-
CURRENT_VALUE_SEQUENCE_FORMAT
- See Also:
-
NEXT_VALUE_SEQUENCE_FORMAT
- See Also:
-
SCHEMA_FORMAT
- See Also:
-
DOT
- See Also:
-
mappingBeanToDb
-
sequences
-
schema
-
-
Constructor Details
-
DBMapping
- Throws:
IOException
-
-
Method Details
-
getContractClass
protected abstract Class<? extends TopiaEntity> getContractClass(Class<? extends TopiaEntity> entityClass) throws TopiaException - Throws:
TopiaException
-
init
public void init(TopiaApplicationContext ctxt, boolean doCreate, boolean doUpdate) throws TopiaException - Throws:
TopiaException
-
createSequences
- Throws:
TopiaException
-
updateSequences
- Throws:
TopiaException
-
existSequence
- Throws:
TopiaException
-
createSequence
- Throws:
TopiaException
-
updateSequence
- Throws:
TopiaException
-
getCurrentValueFromSequence
public BigInteger getCurrentValueFromSequence(String sequenceKey, TopiaSqlSupport ctxt) throws TopiaException - Throws:
TopiaException
-
getNextValueFromSequence
public BigInteger getNextValueFromSequence(String sequenceKey, TopiaSqlSupport ctxt) throws TopiaException - Throws:
TopiaException
-
existSequence
public boolean existSequence(Class<? extends TopiaEntity> entityClass, String propertyName, TopiaSqlSupport ctxt) throws TopiaException - Throws:
TopiaException
-
createSequence
public void createSequence(Class<? extends TopiaEntity> entityClass, String propertyName, TopiaSqlSupport ctxt) throws TopiaException - Throws:
TopiaException
-
updateSequence
public void updateSequence(Class<? extends TopiaEntity> entityClass, String propertyName, TopiaSqlSupport ctxt) throws TopiaException - Throws:
TopiaException
-
getCurrentValueFromSequence
public BigInteger getCurrentValueFromSequence(Class<? extends TopiaEntity> entityClass, String propertyName, TopiaSqlSupport ctxt) throws TopiaException - Throws:
TopiaException
-
getNextValueFromSequence
public BigInteger getNextValueFromSequence(Class<? extends TopiaEntity> entityClass, String propertyName, TopiaSqlSupport ctxt) throws TopiaException - Throws:
TopiaException
-
getSequenceKeysIterator
-
existSequence
public boolean existSequence(String sequenceKey, TopiaSqlSupport ctxt, boolean check) throws TopiaException - Throws:
TopiaException
-
createSequence
public void createSequence(String sequenceKey, TopiaSqlSupport ctxt, boolean check) throws TopiaException - Throws:
TopiaException
-
updateSequence
public void updateSequence(String sequenceKey, TopiaSqlSupport sqlSupport, boolean check) throws TopiaException - Throws:
TopiaException
-
getCurrentValueFromSequence
public BigInteger getCurrentValueFromSequence(String sequenceKey, TopiaSqlSupport ctxt, boolean check) throws TopiaException - Throws:
TopiaException
-
getNextValueFromSequence
public BigInteger getNextValueFromSequence(String sequenceKey, TopiaSqlSupport ctxt, boolean check) throws TopiaException - Throws:
TopiaException
-
getDBProperty
protected String getDBProperty(Class<? extends TopiaEntity> entityClass, String property) throws TopiaException - Parameters:
entityClass- the seek entity classproperty- the name of the property to translate- Returns:
- the DB name for the given property
- Throws:
TopiaException- if any db pb
-
getDBTable
- Parameters:
entityClass- the seek entity class- Returns:
- the DB name for the given property
- Throws:
TopiaException- if any db pb
-
getSequenceSQL
protected String getSequenceSQL(String pattern, Class<? extends TopiaEntity> entityClass, String propertyName) throws TopiaException - Throws:
TopiaException
-
getSequenceSQL
- Throws:
TopiaException
-
getBigInteger
protected BigInteger getBigInteger(TopiaSqlSupport sqlSupport, String sql, BigInteger defaultSize) throws TopiaException - Throws:
TopiaException
-
doSQLWork
- Throws:
TopiaException
-
getSequencePropertyName
-
checkSequence
protected String checkSequence(Class<? extends TopiaEntity> entityClass, String propertyName) throws IllegalArgumentException, TopiaException -
checkSequence
-
initMapping
- Throws:
IOException
-
finalize
-
close
public void close()
-