|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--velosurf.model.Entity
The Entity class represents an entity in the data model. It should not be constructed directly.
Field Summary | |
protected java.util.Map |
mActionMap
actions of this entity |
protected java.util.Map |
mAttributeMap
attributes of this entity |
protected Cache |
mCache
the cache |
protected int |
mCachingMethod
the caching method |
protected java.util.List |
mColumns
column names in natural order |
protected DBConnection |
mDB
the database connection |
protected boolean |
mExplicit
whether this entity is explicitely declared in the config file |
protected java.lang.String |
mFetchQuery
the SQL query used to fetch one instance of this entity |
protected java.lang.Class |
mInstanceClass
the java class to use to realize this instance |
protected boolean[] |
mKeyColObfuscated
obfuscation status of key columns |
protected java.util.List |
mKeys
key column names in natural order |
protected long |
mLastInsertID
the last insert id |
protected java.lang.String |
mName
name |
protected boolean |
mObfuscate
whether to obfuscate something |
protected java.util.List |
mObfuscatedColumns
names of obfuscated columns |
protected boolean |
mReadOnly
whether this entity is read-only or not |
protected java.lang.String |
mTable
table |
Constructor Summary | |
Entity(DBConnection inDB,
java.lang.String inName,
boolean inAccess,
int inCachingMethod)
Constructor reserved for the framework |
Method Summary | |
void |
addColumn(java.lang.String inColName)
add a column at the end of the sequential list of named columns (called during the reverse engeenering of the database) |
void |
addKey(java.lang.String inColName)
adds a key column to the sequential list of the key columns (called during the reverse-engeenering of the database) |
protected void |
buildFetchQuery()
build the SQL query used to fetch one instance of this query |
protected java.lang.Object |
buildKey(DataAccessor inValues)
build the key for the Cache from a DataAccessor |
protected java.lang.Object |
buildKey(java.util.Map inValues)
build the key for the Cache from a DataAccessor |
void |
clearCache()
Clear the cache |
void |
defineAction(org.jdom.Element inJDOMAction)
defines a new action in this entity (called during the reading of the config file) |
void |
defineAttribute(org.jdom.Element inJDOMAttribute)
defines a new attribute in this entity (called during the reading of the config file) |
boolean |
delete(java.util.Map inValues)
delete a row based on (key) values in a Map |
java.lang.String |
deobfuscate(java.lang.Object value)
de-obfuscate given value |
protected void |
extractColumnValues(DataAccessor inSource,
java.util.Map inTarget)
extract column values from an input DataAccessor source and store result in inTarget |
Instance |
fetch(java.util.List inValues)
fetch an instance from key values stored in a List in natural order |
Instance |
fetch(java.util.Map inValues)
fetch an instance from key values stored in a Map |
Instance |
fetch(java.lang.Number inKeyValue)
fetch an instance from its key value specified as a Number |
Instance |
fetch(java.lang.String inKeyValue)
fetch an instance from its key value as a string |
Action |
getAction(java.lang.String inProperty)
get the named action from this entity |
Attribute |
getAttribute(java.lang.String inProperty)
Get a named attribute of this entity |
java.util.List |
getColumns()
getter for the list of column names |
DBConnection |
getDB()
get the database connection |
java.lang.String |
getFetchQuery()
get the SQL query string used to fetch one instance of this query |
Instance |
getInstance(DataAccessor inValues)
get an instance from its values contained in a DataAccessor object (by default, update all fields based on the values in the DataAccessor if the instance has been found in the cache) |
Instance |
getInstance(DataAccessor inValues,
boolean inUpdateValues)
get an instance from a DataAccessor object |
Instance |
getInstance(java.util.Map inValues)
get an instance whose values are in a map (by default, do not update instance values with map values if the instance is found in the cache) |
Instance |
getInstance(java.util.Map inValues,
boolean inUpdateValues)
get an instance whose values are in a map |
java.util.List |
getKeys()
getter for the list of key column names |
long |
getLastInsertID()
get the last insert id |
java.lang.String |
getName()
getter for the name of this entity |
java.lang.String |
getTable()
get the name of the mapped table |
boolean |
insert(DataAccessor inValues)
insert a new row based on values of a map |
boolean |
insert(java.util.Map inValues)
insert a new row based on values of a map |
boolean |
isExplicit()
checks wether or not this entity has been explicitely declared in the configuration file |
boolean |
isObfuscated(java.lang.String inColumn)
returns whether the given column is obfuscated |
Instance |
newInstance()
create a new realisation of this entity |
Instance |
newInstance(DataAccessor inValues)
build a new instance from a DataAccessor object |
Instance |
newInstance(java.util.Map inValues)
builds a new instance from values contained in a Map |
java.lang.String |
obfuscate(java.lang.Object value)
obfuscate given value |
RowIterator |
query()
issue a query to iterate though all instances of this entity |
RowIterator |
query(java.util.List inRefineCriteria,
java.lang.String inOrder)
issue a query to iterate thought instances of this entity, with a facultative refining criteria and a facultative order by clause |
void |
rename(java.lang.String inName)
set the name of this entity ** DO NOT USE DIRECTLY ** |
void |
setCachingMethod(int inCaching)
Specify the caching method, see Cache for allowed constants. |
void |
setExplicit(boolean inExplicit)
sets wether or not this entity has been explicitely declared in the configuration file |
void |
setInstanceClass(java.lang.String inClassName)
Specify a custom class to use when instanciating this entity |
void |
setLastInsertID(long inLastInsertID)
sets the last insert id (do not use directly !) |
void |
setObfuscated(java.util.List inColumns)
indicates a column as being obfuscated |
void |
setReadOnly(boolean inReadOnly)
set this entity to be read-only or read-write |
void |
setTable(java.lang.String inTable)
set the name of the table mapped by this entity |
boolean |
update(java.util.Map inValues)
update a row based on values of a Map |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected java.lang.String mName
protected java.lang.String mTable
protected java.util.List mColumns
protected java.util.List mKeys
protected boolean mObfuscate
protected java.util.List mObfuscatedColumns
protected boolean[] mKeyColObfuscated
protected java.util.Map mAttributeMap
protected java.util.Map mActionMap
protected java.lang.Class mInstanceClass
protected java.lang.String mFetchQuery
protected boolean mReadOnly
protected DBConnection mDB
protected long mLastInsertID
protected int mCachingMethod
protected Cache mCache
protected boolean mExplicit
Constructor Detail |
public Entity(DBConnection inDB, java.lang.String inName, boolean inAccess, int inCachingMethod)
inDB
- database connectioninName
- entity nameinAccess
- access mode (read-write or read-only)inCachingMethod
- caching method to be usedMethod Detail |
public void addColumn(java.lang.String inColName)
inColName
- column namepublic void addKey(java.lang.String inColName)
inColName
- name of the key columnpublic Attribute getAttribute(java.lang.String inProperty)
inProperty
- attribute namepublic Action getAction(java.lang.String inProperty)
inProperty
- action namepublic void defineAction(org.jdom.Element inJDOMAction)
inJDOMAction
- the xml tree for the new actionpublic void defineAttribute(org.jdom.Element inJDOMAttribute)
inJDOMAttribute
- the XML tree for this attributepublic void setInstanceClass(java.lang.String inClassName)
inClassName
- the java class namepublic void setCachingMethod(int inCaching)
Cache
for allowed constants.inCaching
- Caching methodpublic void clearCache()
public Instance newInstance()
public Instance newInstance(java.util.Map inValues)
inValues
- the Map containing the valuespublic Instance newInstance(DataAccessor inValues)
inValues
- the DataAccessor object containing the valuespublic Instance getInstance(java.util.Map inValues)
inValues
- the map containing the key valuespublic Instance getInstance(java.util.Map inValues, boolean inUpdateValues)
inValues
- the map containing the valuesinUpdateValues
- whether the instance should be updated from the
map if found in the cachepublic Instance getInstance(DataAccessor inValues)
inValues
- the DataAccessor object containing the valuespublic Instance getInstance(DataAccessor inValues, boolean inUpdateValues)
inValues
- the DataAccessor object containing the valuesinUpdateValues
- whether all values are to be read from the
DataAccessor if the instance has been found in the cacheprotected void extractColumnValues(DataAccessor inSource, java.util.Map inTarget) throws java.sql.SQLException
inSource
- DataAccessor source objectinTarget
- Map target objectprotected java.lang.Object buildKey(DataAccessor inValues) throws java.sql.SQLException
inValues
- the DataAccessor containing all valuesjava.sql.SQLException
- the getter of the DataAccessor throws an
SQLExceptionprotected java.lang.Object buildKey(java.util.Map inValues) throws java.sql.SQLException
inValues
- the DataAccessor containing all valuesjava.sql.SQLException
- the getter of the DataAccessor throws an
SQLExceptionpublic java.lang.String getName()
public void rename(java.lang.String inName)
inName
- new namepublic java.util.List getKeys()
public java.util.List getColumns()
public boolean insert(java.util.Map inValues)
inValues
- the Map object containing the valuespublic boolean insert(DataAccessor inValues) throws java.sql.SQLException
inValues
- the Map object containing the valuespublic void setLastInsertID(long inLastInsertID)
inLastInsertID
- the last insert idpublic long getLastInsertID()
public boolean update(java.util.Map inValues)
inValues
- the Map object containing the valuespublic boolean delete(java.util.Map inValues)
inValues
- the Map containing the valuespublic Instance fetch(java.util.List inValues)
inValues
- the List containing the key valuespublic Instance fetch(java.util.Map inValues)
inValues
- the Map containing the key valuespublic Instance fetch(java.lang.String inKeyValue)
inKeyValue
- the keypublic Instance fetch(java.lang.Number inKeyValue)
inKeyValue
- the keypublic java.lang.String getFetchQuery()
protected void buildFetchQuery()
public RowIterator query()
public RowIterator query(java.util.List inRefineCriteria, java.lang.String inOrder)
inRefineCriteria
- a refining criteria or null to get all instancesinOrder
- an 'order by' clause or null to get instances in their
natural orderpublic DBConnection getDB()
public void setReadOnly(boolean inReadOnly)
inReadOnly
- the mode to switch to : true for read-only, false for
read-writepublic void setTable(java.lang.String inTable)
inTable
- the table mapped by this entity
read-writepublic java.lang.String getTable()
public void setExplicit(boolean inExplicit)
inExplicit
- value to setpublic boolean isExplicit()
public void setObfuscated(java.util.List inColumns)
inColumns
- list of obfuscated columnspublic boolean isObfuscated(java.lang.String inColumn)
inColumn
- the name of the columnpublic java.lang.String obfuscate(java.lang.Object value)
value
- value to obfuscatepublic java.lang.String deobfuscate(java.lang.Object value)
value
- value to de-obfuscate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |