|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.AbstractMap | +--java.util.HashMap | +--velosurf.context.Instance
An Instance provides field values by their name, choosing in a transparent way between the associated RowIterator or the Map its implement.
Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
Field Summary | |
protected DBConnection |
mDB
the main database connection |
protected Entity |
mEntity
this Instance's Entity |
protected RowIterator |
mRowIterator
the associated RowIterator |
Fields inherited from class java.util.HashMap |
count, emptyHashIterator, ENTRIES, entrySet, KEYS, keySet, loadFactor, modCount, serialVersionUID, table, threshold, values, VALUES |
Constructor Summary | |
Instance(Entity inEntity)
Build an empty instance for the given entity |
Method Summary | |
boolean |
delete()
Delete the row associated with this Instance. |
java.lang.Object |
get(java.lang.Object inKey)
Generic getter, used to access this instance properties by their name. |
java.lang.String |
getEntity()
Get the name of this Instance's Entity. |
java.lang.Object |
getInternal(java.lang.Object inKey)
Internal getter : access only Map interface |
java.util.List |
getKeys()
Deprecated. As of Velosurf version 0.9, replaced by getPrimaryKey Returns an ArrayList of two-entries maps ('name' & 'value'), meant to be use in a #foreach loop to build form fields, like :
<input type=hidden name='$field.name' value='$field.value'>
#end |
java.util.List |
getPrimaryKey()
Returns an ArrayList of two-entries maps ('name' & 'value'), meant to be use in a #foreach loop to build form fields, like : |
protected java.lang.String |
getTable()
Get the name of the table mapped by this Instance's Entity. |
void |
initialize()
Meant to be overloaded |
boolean |
insert()
Insert a new row corresponding to this Instance. |
void |
setRowIterator(RowIterator inRowIterator)
Set the RowIterator this Instance is bound to, when used in a #foreach directive. |
boolean |
update()
Update the row associated with this Instance from passed values |
boolean |
update(java.util.Map inValues)
Update the row associated with this Instance from actual values |
Methods inherited from class java.util.HashMap |
|
Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
Field Detail |
protected RowIterator mRowIterator
protected Entity mEntity
protected DBConnection mDB
Constructor Detail |
public Instance(Entity inEntity)
inEntity
- Entity this instance is a realisation ofMethod Detail |
public void initialize()
public void setRowIterator(RowIterator inRowIterator)
inRowIterator
- the RowIterator this Instance is bound to.public java.lang.String getEntity()
protected java.lang.String getTable()
public java.util.List getKeys()
<input type=hidden name='$field.name' value='$field.value'>
#end
#foreach ($field in $product.keys)
public java.util.List getPrimaryKey()
<input type=hidden name='$field.name' value='$field.value'>
#end
#foreach ($field in $product.primaryKey)
public java.lang.Object get(java.lang.Object inKey)
Asked property is first searched in the Map, then as a column of the bound RowIterator (if present), and at least among Attributes defined for the entity.
get
in interface DataAccessor
get
in class java.util.HashMap
inKey
- key of the property to be returnedpublic java.lang.Object getInternal(java.lang.Object inKey)
inKey
- key of the property to be returnedpublic boolean update()
Velosurf will ensure all key columns are specified, to avoid an accidental massive update.
true
if successfull, false
if an error
occurs (in which case $db.lastError can be checked).public boolean update(java.util.Map inValues)
Velosurf will ensure all key columns are specified, to avoid an accidental massive update.
inValues
- values to be used for the updatetrue
if successfull, false
if an error
occurs (in which case $db.lastError can be checked).public boolean delete()
Velosurf will ensure all key columns are specified, to avoid an accidental massive update.
true
if successfull, false
if an error
occurs (in which case $db.lastError can be checked).public boolean insert()
true
if successfull, false
if an error
occurs (in which case $db.lastError can be checked).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |