|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList
velosurf.context.EntityReference
public class EntityReference
Context wrapper for an entity.
| Field Summary | |
|---|---|
protected Entity |
entity
the wrapped entity |
protected java.lang.String |
order
specified order |
protected java.util.List |
refineCriteria
specified refining criteria |
protected UserContext |
userContext
user context to give to created instances |
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
EntityReference(Entity entity)
Builds a new EntityReference. |
|
EntityReference(Entity entity,
UserContext userContext)
Builds a new EntityReference. |
|
| Method Summary | |
|---|---|
void |
clearRefinement()
Clears any refinement made on this entity |
boolean |
delete(java.util.Map values)
Detele a row from this entity's table. |
Instance |
fetch(java.util.List values)
Fetch an Instance of this entity, specifying the values of its key columns in their natural order. |
Instance |
fetch(java.util.Map values)
Fetch an Instance of this entity, specifying the values of its key columns in the map. |
Instance |
fetch(java.lang.Number keyValue)
Fetch an Instance of this entity, specifying the value of its unique key column as an integer |
Instance |
fetch(java.lang.String keyValue)
Fetch an Instance of this entity, specifying the value of its unique key column as a string |
java.lang.Object |
get(int i)
Dummy method. |
java.util.List |
getColumns()
getter for the list of column names |
java.lang.Object |
getLastInsertID()
Returns the ID of the last inserted row (obfuscated if needed) |
java.lang.String |
getName()
gets the name of the wrapped entity |
java.util.List |
getRows()
gets all the rows in a list of maps |
boolean |
insert(java.util.Map values)
Insert a new row in this entity's table. |
java.util.Iterator |
iterator()
Called by the #foreach directive. |
Instance |
newInstance()
Create a new instance for this entity |
void |
refine(java.lang.String criterium)
Refines this entity reference querying result: the provided criterium will be added to the 'where' clause (or a 'where' clause will be added). |
void |
setOrder(java.lang.String order)
Specify an 'order by' clause for this attribute reference result. |
int |
size()
Dummy method. |
boolean |
update(java.util.Map values)
Update a row in this entity's table. |
boolean |
validate(java.util.Map values)
|
| Methods inherited from class java.util.AbstractList |
|---|
add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Field Detail |
|---|
protected Entity entity
protected java.lang.String order
protected java.util.List refineCriteria
protected UserContext userContext
| Constructor Detail |
|---|
public EntityReference(Entity entity)
entity - the wrapped entity
public EntityReference(Entity entity,
UserContext userContext)
entity - the wrapped entity| Method Detail |
|---|
public java.lang.String getName()
public boolean insert(java.util.Map values)
values - col -> value map
true if successfull, false if an error occurs (in which case $db.lastError can be checked).public java.lang.Object getLastInsertID()
public boolean update(java.util.Map values)
Velosurf will ensure all key columns are specified, to avoid an accidental massive update.
values - col -> value map
true if successfull, false if an error occurs (in which case $db.lastError can be checked).public boolean delete(java.util.Map values)
Velosurf will ensure all key columns are specified, to avoid an accidental massive update.
values - col -> value map
true if successfull, false if an error occurs (in which case $db.lastError can be checked).public Instance fetch(java.util.List values)
values - values of the key columns
public Instance fetch(java.util.Map values)
values - key=>value map
public Instance fetch(java.lang.String keyValue)
keyValue - value of the key column
public Instance fetch(java.lang.Number keyValue)
keyValue - value of the key column
public java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.Listiterator in class java.util.AbstractListpublic java.util.List getRows()
public void refine(java.lang.String criterium)
This method can be called several times, thus allowing a field-by-field handling of an html search form.
All criteria will be merged with the sql 'and' operator (if there is an initial where clause, it is wrapped into parenthesis).
Example: if we issue the following calls from inside the template:
$person.refine("age>30")the resulting query that will be issed is:$person.refine("salary>3000")
select * from person where (age>30) and (salary>3000)
criterium - a valid sql conditionpublic void clearRefinement()
public void setOrder(java.lang.String order)
If an 'order by' clause is already present in the original query, the new one is appended (but successive calls to this method overwrite previous ones)
Pass it null or an empty string to clear any ordering.
order - valid sql column names (separated by commas) indicating the
desired orderpublic Instance newInstance()
public boolean validate(java.util.Map values)
public java.util.List getColumns()
public java.lang.Object get(int i)
get in interface java.util.Listget in class java.util.AbstractListi - ignored
public int size()
size in interface java.util.Collectionsize in interface java.util.Listsize in class java.util.AbstractCollection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||