|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.rt.Introspector
org.norther.tammi.spray.engine.tool.BeanTool
org.norther.tammi.spray.db.tool.RepositoryTool
public class RepositoryTool
A request context tool to create and access persistent objects.
| Constructor Summary | |
|---|---|
RepositoryTool()
The default constructor. |
|
| Method Summary | |
|---|---|
void |
abortTransaction()
Aborts a transaction. |
boolean |
addValues(Object node,
String name,
List result)
Adds nested attribute values in a tree to a list. |
void |
beginTransaction()
Starts a transaction. |
DBQuery |
buildQuery(Object sample)
Builds a query by sample. |
DBQuery |
buildQuery(String className,
DBCriteria criteria,
boolean distinct)
Builds a query by criteria. |
DBQuery |
buildQuery(String className,
List columns,
DBCriteria criteria,
boolean distinct)
Builds a query by criteria with a column array. |
DBQuery |
buildQuery(String className,
String expr,
boolean sql)
Builds a query by expression. |
void |
clearCache()
Clears the object cache, if any. |
void |
commitTransaction()
Commits and closes a transaction. |
int |
count(Object query)
Returns the count of objects specified by a query or class name. |
int |
count(String className,
DBCriteria criteria)
Returns the count of objects of the given class matching the specified criteria. |
int |
count(String className,
String attribute,
Object value,
int condition)
Returns the count of objects of the given class having the specified attribute. |
protected Variable |
createVariable(String type)
Creates a variable MBean instance. |
boolean |
delete(Object object)
Deletes an object. |
boolean |
deleteAll(Object query)
Deletes objects. |
boolean |
deleteAll(String className,
DBCriteria criteria)
Deletes objects of the given class matching the specified criteria. |
boolean |
deleteAll(String className,
String attribute,
Object value,
int condition)
Deletes objects of the given class having the specified attribute. |
int |
depth(Object node,
String rel)
Returns the reference depth of a node. |
void |
dispose()
Disposes the object after use. |
int |
distinctCount(String className,
DBCriteria criteria)
Returns the count of distinct objects of the given class matching the specified criteria. |
int |
distinctCount(String className,
String attribute,
Object value,
int condition)
Returns the count of distinct objects of the given class having the specified attribute. |
QueryIterator |
distinctIterator(String className,
DBCriteria criteria)
Returns an iterator to a collection of distinct objects of the given class matching the specified criteria. |
QueryIterator |
distinctIterator(String className,
String attribute,
Object value,
int condition)
Returns an iterator to a collection of distinct objects of the given class having the specified attribute. |
Object |
getAdaptee()
Gets the persister adaptee, if any. |
protected BeanRepositoryFilter |
getBeanRepositoryFilter()
Gets the bean repository filter from the filter stack. |
List |
getChain(Object node,
String rel)
Gets a chain of referenced objects in a tree, the end node at the lowest index. |
List |
getChain(Object node,
String rel,
String name)
Gets a chain of attribute values of referenced objects in a tree, the attribute of the end node at the lowest index. |
String |
getConnectionKey()
Gets the connection key of the current connection. |
DBCriteria |
getCriteria()
Gets an empty criteria. |
Object |
getEnd(Object node,
String rel)
Gets the end node in a tree. |
VariableAttributeInfo |
getInfo(Variable variable,
String name)
Gets nested attribute info in a tree. |
List |
getList(Object node,
String rel)
Gets the next nodes in a tree. |
Map |
getMap(Object node,
String rel)
Gets a map of referenced objects in a tree. |
Map |
getMap(Object node,
String rel,
String name)
Gets a map of attribute values of referenced objects in a tree. |
Object |
getNext(Object node,
int index,
String rel)
Gets the indexed node in a tree. |
Object |
getNext(Object node,
String rel)
Gets the next node in a tree. |
Persister |
getPersister()
Gets the persister with the current connection settings. |
Object |
getPKValue(Object node)
Gets the primary key value. |
Object[] |
getPKValues(Object node)
Gets the primary key values. |
protected RepositoryFilter |
getRepositoryFilter()
Gets the repository filter from the filter stack. |
Object |
getRoot(Object node,
String rel)
Gets the root node in a tree. |
Object |
getValue(Object node,
String name)
Gets a nested attribute value in a tree. |
Object |
getValue(Variable variable,
String name)
Gets a nested attribute value in a tree. |
List |
getValues(Object node,
String name)
Gets a list of nested attribute values in a tree. |
boolean |
hasNext(Object node,
String rel)
Checks whether a node in a tree has a reference to the next one. |
boolean |
insert(Object object)
Inserts an object. |
boolean |
insertAll(Collection c)
Inserts objects. |
boolean |
isLocalizedVariables()
Checks whether variables are localized. |
boolean |
isNullPK(Object pk)
Checks whether the specified primary key value is a null key. |
boolean |
isRelated(Object node,
String rel,
Object pk)
Checks whether a node in a tree is related to the specified key. |
boolean |
isRootPK(Object pk)
Checks whether the specified primary key value is a root key. |
QueryIterator |
iterator(Object query)
Returns an iterator to a collection of objects specified by a query or class name. |
QueryIterator |
iterator(String className,
DBCriteria criteria)
Returns an iterator to a collection of objects of the given class matching the specified criteria. |
QueryIterator |
iterator(String className,
String attribute,
Object value,
int condition)
Returns an iterator to a collection of objects of the given class having the specified attribute. |
Object |
query(Object sample)
Queries a named MBean or an object matching the given sample regarding its fields. |
Object |
query(String className,
Object value)
Queries an object of the given class. |
Object |
query(String className,
String attribute,
Object value)
Queries an object of the given class having the specified attribute. |
Collection |
queryAll(Object query)
Queries a collection of objects specified by a query or class name. |
Collection |
queryAll(String className,
DBCriteria criteria)
Queries objects of the given class matching the specified criteria. |
Collection |
queryAll(String className,
String attribute,
Object value,
int condition)
Queries objects of the given class having the specified attribute. |
Collection |
queryDistinct(String className,
DBCriteria criteria)
Queries distinct objects of the given class matching the specified criteria. |
Collection |
queryDistinct(String className,
String attribute,
Object value,
int condition)
Queries distinct objects of the given class having the specified attribute. |
void |
refresh(Object object)
Refreshes references. |
void |
refresh(Object object,
String name)
Retrieves a named reference. |
void |
remove(Object object)
Removes an object from the cache. |
void |
setConnectionKey()
Sets the connection key of the current connection to the default connection. |
void |
setConnectionKey(String key)
Sets the connection key of the current connection. |
void |
setPKValue(Object node,
Object value)
Sets the primary key value. |
void |
setPKValues(Object node,
Object[] values)
Sets the primary key values. |
void |
setValue(Object node,
String name,
Object value)
Sets a nested attribute value in a tree. |
void |
setValue(Object node,
String name,
Object value,
boolean forced)
Sets a nested attribute value in a tree with a forced option. |
void |
setValue(Variable variable,
String name,
Object value)
Sets a nested attribute value in a tree. |
void |
setValue(Variable variable,
String name,
Object value,
boolean forced)
Sets a nested attribute value in a tree with a forced option. |
boolean |
store(Object object)
Stores an object. |
boolean |
storeAll(Collection c)
Stores objects. |
Identity |
toIdentity(Object[] pks,
String type)
Returns the identity of the specified primary keys and variable type. |
Identity |
toIdentity(Object pk,
String type)
Returns the identity of the specified primary key and variable type. |
Identity |
toIdentity(Variable var)
Returns the identity of the specified variable. |
boolean |
update(Object object)
Updates an object. |
boolean |
updateAll(Collection c)
Updates objects. |
| Methods inherited from class org.norther.tammi.spray.engine.tool.BeanTool |
|---|
addValue, addValue, create, create, create, create, disposed, getContext, getContextToolFilter, getDefaultLocale, getDescription, getDetail, getEnumeration, getFilter, getFilterChain, getFilterKey, getGroup, getKeyValue, getMBeanServer, getName, getPrincipal, getRequest, getResourceMap, getResponse, getValue, getVariableRegistry, isBound, isDisposed, isFilterChanged, length, recycle, recycled, removeValue, removeValue, setValue, toString, toStrings, valueBound, valueUnbound |
| Methods inherited from class org.norther.tammi.core.rt.Introspector |
|---|
clearResourceCache, contains, exportTo, exportTo, getComparator, getConverter, getInfo, getList, getList, getLocale, getMax, getMin, getPattern, getResource, getResourceBundle, getResourceBundle, getResourceBundleName, getResourceBundleName, hasConverter, importFrom, importFrom, isArray, isBlankAccepted, isCloneable, isCorrelative, isDisabled, isEmptyAccepted, isEnumerated, isInteractive, isLocal, isLocalized, isMandatory, isOrdered, isReadable, isSerialized, isSorted, isTraceable, isTransient, isTrimmed, isVisible, isWritable, setLocale |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RepositoryTool()
| Method Detail |
|---|
public void dispose()
Recyclable
dispose in interface Recyclabledispose in class BeanToolpublic String getConnectionKey()
public void setConnectionKey()
public void setConnectionKey(String key)
key - the connection key or alias.public Persister getPersister()
public void clearCache()
public void remove(Object object)
object - the object.public void refresh(Object object)
object - the object.
public void refresh(Object object,
String name)
object - the object.name - the name of the reference.public DBCriteria getCriteria()
public DBQuery buildQuery(Object sample)
sample - the sample object.
public DBQuery buildQuery(String className,
String expr,
boolean sql)
className - the class name to query.expr - the query expression.sql - an SQL option.
public DBQuery buildQuery(String className,
DBCriteria criteria,
boolean distinct)
className - the class name to query.criteria - the criteria to apply.distinct - true for a distinct query, false otherwise.
public DBQuery buildQuery(String className,
List columns,
DBCriteria criteria,
boolean distinct)
className - the class name to query.columns - a list of column names.criteria - the criteria to apply.distinct - true for a distinct query, false otherwise.
public Object query(Object sample)
sample - the sample object to match to.
public Object query(String className,
Object value)
className - the class name of objects to return.value - the primary key value of the object.
public Object query(String className,
String attribute,
Object value)
className - the class name of objects to return.attribute - the name of the attribute.value - the value of the attribute.
public Collection queryAll(Object query)
query - the query or class name of objects to return.
public Collection queryAll(String className,
DBCriteria criteria)
className - the class name of objects to return.criteria - implementation specific criteria.
public Collection queryAll(String className,
String attribute,
Object value,
int condition)
className - the class name of objects to return.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
public QueryIterator iterator(Object query)
query - the query or class name of objects to return.
public QueryIterator iterator(String className,
DBCriteria criteria)
className - the class name of objects to return.criteria - implementation specific criteria.
public QueryIterator iterator(String className,
String attribute,
Object value,
int condition)
className - the class name of objects to return.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
public int count(Object query)
query - the query or class name of objects to return.
public int count(String className,
DBCriteria criteria)
className - the class name of objects to count.criteria - implementation specific criteria.
public int count(String className,
String attribute,
Object value,
int condition)
className - the class name of objects to return.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
public Collection queryDistinct(String className,
DBCriteria criteria)
className - the class name of objects to return.criteria - implementation specific criteria.
public Collection queryDistinct(String className,
String attribute,
Object value,
int condition)
className - the class name of objects to return.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
public QueryIterator distinctIterator(String className,
DBCriteria criteria)
className - the class name of objects to return.criteria - implementation specific criteria.
public QueryIterator distinctIterator(String className,
String attribute,
Object value,
int condition)
className - the class name of objects to return.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
public int distinctCount(String className,
DBCriteria criteria)
className - the class name of objects to count.criteria - implementation specific criteria.
public int distinctCount(String className,
String attribute,
Object value,
int condition)
className - the class name of objects to return.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
public boolean store(Object object)
object - an object to store.
public boolean storeAll(Collection c)
c - a collection to store.
public boolean insert(Object object)
object - an object to insert.
public boolean insertAll(Collection c)
c - a collection to insert.
public boolean update(Object object)
object - an object to update.
public boolean updateAll(Collection c)
c - a collection to update.
public boolean delete(Object object)
object - an object to delete.
public boolean deleteAll(Object query)
query - a query, class name or collection of objects to delete.
public boolean deleteAll(String className,
DBCriteria criteria)
className - the class name of objects to return.criteria - implementation specific criteria.
public boolean deleteAll(String className,
String attribute,
Object value,
int condition)
className - the class name of objects to return.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
public void beginTransaction()
public void commitTransaction()
public void abortTransaction()
public boolean isNullPK(Object pk)
pk - the pk to check.
public boolean isRootPK(Object pk)
pk - the pk to check.
public Object getPKValue(Object node)
node - the node object.
public void setPKValue(Object node,
Object value)
node - the node object.value - the primary key value.public Object[] getPKValues(Object node)
node - the node object.
public void setPKValues(Object node,
Object[] values)
node - the node object.values - the primary key values.
public VariableAttributeInfo getInfo(Variable variable,
String name)
getInfo in class Introspectorvariable - the variable.name - the attribute name(s).
public Object getValue(Variable variable,
String name)
This method is required to override an inherited method.
getValue in class BeanToolvariable - the variable.name - the attribute name(s).
public void setValue(Variable variable,
String name,
Object value)
This method is required to override an inherited method.
setValue in class BeanToolvariable - the variable.name - the attribute name(s).value - the attribute value.
public void setValue(Variable variable,
String name,
Object value,
boolean forced)
This method is required to override an inherited method.
setValue in class BeanToolvariable - the variable.name - the attribute name(s).value - the attribute value.forced - if true, forces the setting.
public Object getValue(Object node,
String name)
node - the node object.name - the attribute name(s).
public void setValue(Object node,
String name,
Object value)
node - the node object.name - the attribute name(s).value - the attribute value.
public void setValue(Object node,
String name,
Object value,
boolean forced)
node - the node object.name - the attribute name(s).value - the attribute value.forced - if true, forces the setting.
public List getValues(Object node,
String name)
node - the node object.name - the attribute name(s).
public boolean addValues(Object node,
String name,
List result)
node - the node object.name - the attribute name(s).result - the attribute list.
public Object getEnd(Object node,
String rel)
node - the node object.rel - the relation attribute.
public Object getRoot(Object node,
String rel)
node - the node object.rel - the relation attribute.
public Object getNext(Object node,
String rel)
node - the node object.rel - the relation attribute.
public Object getNext(Object node,
int index,
String rel)
node - the node object.index - the variable index.rel - the relation attribute.
public List getList(Object node,
String rel)
node - the node object.rel - the relation attribute.
public boolean isRelated(Object node,
String rel,