|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap<K,V> java.util.HashMap<java.lang.String,java.lang.Object> velosurf.context.DBReference
public class DBReference
A context wrapper for the main database connection object.
The "$db
" context variable is assigned a new instance of this class at each velocity parsing.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Field Summary | |
---|---|
private java.util.Map<java.lang.String,java.lang.Object> |
cache
A cache used by the generic getter. |
protected Database |
db
The wrapped database connection. |
private java.util.Map<java.lang.String,java.lang.Object> |
externalParams
The map of external query parameters used by children attributes. |
Constructor Summary | |
---|---|
protected |
DBReference()
Default constructor for use by derived classes. |
|
DBReference(Database db)
Constructs a new database reference. |
Method Summary | |
---|---|
java.lang.String |
deobfuscate(java.lang.Object value)
De-obfuscate the given value. |
java.lang.Object |
get(java.lang.Object key)
Generic getter, used to access entities or root attributes by their name. |
EntityReference |
getEntity(java.lang.String key)
Specific entity getter. |
java.lang.String |
getError()
Specific getter for last error message in user context |
java.lang.String |
getSchema()
Get the schema name. |
UserContext |
getUserContext()
User context getter |
java.lang.Object |
getWithParams(java.lang.String key,
java.util.Map params)
Default method handler, called by Velocity when it did not find the specified method. |
protected void |
init(Database db)
Protected initialization method. |
java.lang.String |
obfuscate(java.lang.Object value)
Obfuscate the given value. |
java.lang.Object |
put(java.lang.String key,
java.lang.Object value)
Generic setter used to set external params for children attributes. |
void |
setUserContext(UserContext userContext)
User context setter |
java.lang.String |
toString()
String representation of this db reference. |
Methods inherited from class java.util.HashMap |
---|
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
---|
equals, hashCode |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Field Detail |
---|
protected Database db
private java.util.Map<java.lang.String,java.lang.Object> cache
private java.util.Map<java.lang.String,java.lang.Object> externalParams
Constructor Detail |
---|
protected DBReference()
public DBReference(Database db)
db
- the wrapped database connectionMethod Detail |
---|
protected void init(Database db)
db
- database connectionpublic java.lang.Object get(java.lang.Object key)
Generic getter, used to access entities or root attributes by their name.
For attributes, the return value depends upon the type of the attribute :
If no attribute is found, entities are searched, then external parameters.
get
in interface java.util.Map<java.lang.String,java.lang.Object>
get
in class java.util.HashMap<java.lang.String,java.lang.Object>
key
- the name of the desired entity or root attribute.
public EntityReference getEntity(java.lang.String key)
Specific entity getter.
key
- the name of the desired entity or root attribute.
public java.lang.String getError()
Specific getter for last error message in user context
public java.lang.Object getWithParams(java.lang.String key, java.util.Map params)
getWithParams
in interface HasParametrizedGetter
key
- asked keyparams
- passed parametersHasParametrizedGetter
public java.lang.Object put(java.lang.String key, java.lang.Object value)
put
in interface java.util.Map<java.lang.String,java.lang.Object>
put
in class java.util.HashMap<java.lang.String,java.lang.Object>
key
- name of the external parametervalue
- value given to the external parameter
public java.lang.String getSchema()
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
public UserContext getUserContext()
public void setUserContext(UserContext userContext)
userContext
- user contextpublic java.lang.String toString()
toString
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |