|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectvelosurf.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 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 |
getTableName()
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 |
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 |
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 |
setTableName(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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 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
| 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 used| Method 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 name
public Action getAction(java.lang.String inProperty)
inProperty - action name
public void defineAction(org.jdom.Element inJDOMAction)
inJDOMAction - the xml tree for the new action
public void defineAttribute(org.jdom.Element inJDOMAttribute)
throws java.sql.SQLException
inJDOMAttribute - the XML tree for this attribute
java.sql.SQLExceptionpublic 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 values
public Instance newInstance(DataAccessor inValues)
inValues - the DataAccessor object containing the values
public Instance getInstance(java.util.Map inValues)
inValues - the map containing the key values
public 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 cache
public Instance getInstance(DataAccessor inValues)
inValues - the DataAccessor object containing the values
public 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 cache
protected void extractColumnValues(DataAccessor inSource,
java.util.Map inTarget)
throws java.sql.SQLException
inSource - DataAccessor source objectinTarget - Map target object
java.sql.SQLException
protected java.lang.Object buildKey(DataAccessor inValues)
throws java.sql.SQLException
inValues - the DataAccessor containing all values
java.sql.SQLException - the getter of the DataAccessor throws an
SQLException
protected java.lang.Object buildKey(java.util.Map inValues)
throws java.sql.SQLException
inValues - the DataAccessor containing all values
java.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 values
public boolean insert(DataAccessor inValues)
throws java.sql.SQLException
inValues - the Map object containing the values
java.sql.SQLExceptionpublic void setLastInsertID(long inLastInsertID)
inLastInsertID - the last insert idpublic long getLastInsertID()
public boolean update(java.util.Map inValues)
inValues - the Map object containing the values
public boolean delete(java.util.Map inValues)
inValues - the Map containing the values
public Instance fetch(java.util.List inValues)
inValues - the List containing the key values
public Instance fetch(java.util.Map inValues)
inValues - the Map containing the key values
public Instance fetch(java.lang.String inKeyValue)
inKeyValue - the key
public Instance fetch(java.lang.Number inKeyValue)
inKeyValue - the key
public 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 order
public DBConnection getDB()
public void setReadOnly(boolean inReadOnly)
inReadOnly - the mode to switch to : true for read-only, false for
read-writepublic void setTableName(java.lang.String inTable)
inTable - the table mapped by this entity
read-writepublic java.lang.String getTableName()
public void setObfuscated(java.util.List inColumns)
inColumns - list of obfuscated columnspublic boolean isObfuscated(java.lang.String inColumn)
inColumn - the name of the column
public java.lang.String obfuscate(java.lang.Object value)
value - value to obfuscate
public java.lang.String deobfuscate(java.lang.Object value)
value - value to de-obfuscate
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||