|
||||||||||
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.DataTool
public class DataTool
A request context tool to create and access persistent objects.
Field Summary | |
---|---|
protected int |
isLocalized
The localized flag. |
Constructor Summary | |
---|---|
DataTool()
The default constructor. |
Method Summary | |
---|---|
void |
abortTransaction()
Aborts a transaction. |
boolean |
addValues(Object node,
String name,
List<Object> result)
Adds nested attribute values in a tree to a list. |
void |
beginTransaction()
Starts a transaction. |
DBQuery<?> |
buildQuery(DBCriteria<?> criteria,
boolean distinct,
Object... clazz)
Builds a query by criteria. |
DBQuery<Object[]> |
buildQuery(DBCriteria<?> criteria,
List<String> attributes,
boolean distinct,
Object... clazz)
Builds a query by criteria with attributes. |
DBQuery<?> |
buildQuery(Object sample)
Builds a query by sample. |
DBQuery<?> |
buildQuery(String className,
String expr,
String type)
Builds a query by expression. |
void |
clearCache()
Clears the object cache, if any. |
protected void |
closeInternalPersister()
Closes the internal persister. |
void |
commitTransaction()
Commits and closes a transaction. |
int |
count(DBCriteria<?> criteria,
Object... clazz)
Returns the result set size of objects matching the specified criteria. |
int |
count(Object query)
Returns the result set size of objects specified by a query or class name. |
protected int |
count(Persister persister,
Variable search,
DBCriteria<?>... criteria)
Returns a meta element result set size for the specified persister and search variable. |
int |
count(String className,
String attribute,
Object value,
String condition)
Returns the result set size of objects of the given class having the specified attribute. |
int |
count(Variable search,
DBCriteria<?>... criteria)
Returns the result set size for the specified search variable. |
protected Variable |
createVariable(String type)
Creates a variable MBean instance. |
boolean |
delete(Object object)
Deletes an object. |
boolean |
deleteAll(DBCriteria<?> criteria)
Deletes objects matching the specified criteria. |
boolean |
deleteAll(Object query)
Deletes objects. |
boolean |
deleteAll(String className,
String attribute,
Object value,
String 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. |
boolean |
exists(Object object)
Checks an object. |
Object |
get(Object object)
Gets an object. |
List<Object> |
getChain(Object node,
String rel)
Gets a chain of referenced objects in a tree, the end node at the lowest index. |
List<Object> |
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 |
getConnectionAlias()
Gets the connection alias of the current connection. |
DBCriteria<?> |
getCriteria(String className)
Gets an empty criteria for the named class. |
protected StepFlowContext |
getCurrentContext()
Gets the current step flow context. |
Object |
getIdValue(Object node)
Gets the identity value. |
Object[] |
getIdValues(Object node)
Gets the identity values. |
VariableAttributeInfo |
getInfo(Variable variable,
String name)
Gets nested attribute info in a tree. |
protected Persister |
getInternalPersister()
Gets the internal persister with the current connection settings. |
Map<Object,Object> |
getMap(Object node,
String rel)
Gets a map of referenced objects in a tree. |
Map<Object,Object> |
getMap(Object node,
String rel,
String name)
Gets a map of attribute values of referenced objects in a tree. |
Variable |
getMetaDesktop()
Gets the meta desktop of the current principal. |
Variable |
getMetaFolder()
Gets the meta folder of the current principal. |
Persister |
getPersister()
Gets the persister with the current connection settings. |
Object |
getReference(Object node,
int index,
String rel)
Gets the indexed referenced node in a tree. |
Object |
getReference(Object node,
String rel)
Gets the referenced node in a tree. |
List<Object> |
getReferences(Object node,
String rel)
Gets the referenced nodes in a tree. |
protected BeanRepositoryFilter |
getRepositoryFilter()
Gets the bean repository filter from the filter stack. |
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<Object> |
getValues(Object node,
String name)
Gets a list of nested attribute values in a tree. |
VarHandler |
getVarHandler()
Gets a var exchange handler. |
VarWriter |
getVarWriter()
Gets a var exchange writer. |
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 |
isLocalized()
Checks whether variables are localized. |
boolean |
isRelated(Object node,
String rel,
Object pk)
Checks whether a node in a tree is related to the specified key. |
QueryIterator<?> |
iterator(DBCriteria<?> criteria,
Object... clazz)
Returns an iterator to a collection of objects matching the specified criteria. |
QueryIterator<?> |
iterator(Object query)
Returns an iterator to a collection of objects specified by a query or sample. |
protected QueryIterator<? extends Variable> |
iterator(Persister persister,
Variable search,
DBCriteria<?>... criteria)
Returns a meta element query iterator for the specified persister and search variable. |
QueryIterator<?> |
iterator(String className,
String attribute,
Object value,
String condition)
Returns an iterator to a collection of objects of the given class having the specified attribute. |
QueryIterator<? extends Variable> |
iterator(Variable search,
DBCriteria<?>... criteria)
Returns a variable query iterator for the specified search variable. |
Object |
merge(Object object)
Merges an object. |
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(DBCriteria<?> criteria,
Object... clazz)
Queries objects of the given class matching the specified criteria. |
Collection<?> |
queryAll(Object query)
Queries a collection of objects specified by a query or sample. |
Collection<?> |
queryAll(String className,
String attribute,
Object value,
String condition)
Queries 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 |
setConnectionAlias(String alias)
Sets the connection alias of the current connection. |
void |
setIdValue(Object node,
Object value)
Sets the identity value. |
void |
setIdValues(Object node,
Object[] values)
Sets the identity values. |
void |
setValue(Object node,
String name,
Object value)
Sets a nested attribute value in a tree. |
void |
setValue(Variable variable,
String name,
Object value)
Sets a nested attribute value in a tree. |
boolean |
store(Object object)
Stores an object. |
boolean |
storeAll(Collection<?> c)
Stores objects. |
Identity |
toIdentity(String type,
Object... pks)
Returns the identity of the specified primary keys 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, create, disposed, getCharacterEncoding, getContext, getContextToolFilter, getDefaultLocale, getDescription, getDetail, getDetail, getEncodingSize, getEnumeration, getEnumeration, getFilter, getFilterChain, getFilterKey, getGroup, getInvalidation, getKeyValue, getKMLWriter, getLOBLinkPattern, getMBeanServer, getPrincipal, getQualifier, getRequest, getResourceMap, getResponse, getValue, getVariableRegistry, isBound, isDisposed, isFilterChanged, length, recycle, recycled, removeValue, removeValue, setValue, toString, toString, toStrings, toStrings, valueBound, valueUnbound |
Methods inherited from class org.norther.tammi.core.rt.Introspector |
---|
clearResourceCache, contains, containsTrait, containsTrait, cutValue, exportTo, exportTo, getComparator, getConverter, getException, getFormat, getInfo, getInfos, getLocale, getMax, getMessage, getMeta, getMin, getNodeValue, getNodeValue, getPattern, getResourceBundle, getResourceBundle, getResourceBundleName, getResourceBundleName, importFrom, importFrom, isArray, isEnumerated, isInvalid, isLOB, isReadable, isTrait, isTrait, isVisible, isWritable, resolve, resolve, setCharacterEncoding, setLOBLinkPattern, setLocale, setTrait, setTrait, toMediaFile, toSerializable, toSerializables |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient int isLocalized
Constructor Detail |
---|
public DataTool()
Method Detail |
---|
public void dispose()
Recyclable
dispose
in interface Recyclable
dispose
in class BeanTool
public String getConnectionAlias()
public void setConnectionAlias(String alias)
alias
- the connection 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(String className)
className
- the criteria type.
public DBQuery<?> buildQuery(Object sample)
sample
- the sample object.
public DBQuery<?> buildQuery(String className, String expr, String type)
className
- the class name to query.expr
- the query expression.type
- the query type.
public DBQuery<?> buildQuery(DBCriteria<?> criteria, boolean distinct, Object... clazz)
criteria
- the criteria to apply.distinct
- true if distinct, false otherwise.clazz
- an optional query class or class name.
public DBQuery<Object[]> buildQuery(DBCriteria<?> criteria, List<String> attributes, boolean distinct, Object... clazz)
attributes
- a list of attribute names.criteria
- the criteria to apply.distinct
- true if distinct, false otherwise.clazz
- an optional query class or class name.
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(DBCriteria<?> criteria, Object... clazz)
criteria
- implementation specific criteria.clazz
- an optional query class or class name.
public Collection<?> queryAll(String className, String attribute, Object value, String 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(DBCriteria<?> criteria, Object... clazz)
criteria
- implementation specific criteria.clazz
- an optional query class or class name.
public QueryIterator<?> iterator(String className, String attribute, Object value, String 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(DBCriteria<?> criteria, Object... clazz)
criteria
- implementation specific criteria.clazz
- an optional query class or class name.
public int count(String className, String attribute, Object value, String 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 exists(Object object)
object
- an object to check.
public Object get(Object object)
object
- an object to get.
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 Object merge(Object object)
object
- an object to merge.
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(DBCriteria<?> criteria)
criteria
- implementation specific criteria.
public boolean deleteAll(String className, String attribute, Object value, String 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<? extends Variable> iterator(Variable search, DBCriteria<?>... criteria)
search
- the search variable.criteria
- the initial criteria.
public int count(Variable search, DBCriteria<?>... criteria)
search
- the search variable.criteria
- the initial criteria.
public void beginTransaction()
public void commitTransaction()
public void abortTransaction()
public Object getIdValue(Object node)
node
- the node object.
public void setIdValue(Object node, Object value)
node
- the node object.value
- the identity value.public Object[] getIdValues(Object node)
node
- the node object.
public void setIdValues(Object node, Object[] values)
node
- the node object.values
- the identity values.public VariableAttributeInfo getInfo(Variable variable, String name)
variable
- 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 BeanTool
variable
- 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 BeanTool
variable
- the variable.name
- the attribute name(s).value
- the attribute value.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 List<Object> getValues(Object node, String name)
node
- the node object.name
- the attribute name(s).
public boolean addValues(Object node, String name, List<Object> result)
node
- the node object.name
- the attribute name(s).result
- the attribute list.
public Object getReference(Object node, String rel)
node
- the node object.rel
- the relation attribute.
public Object getReference(Object node, int index, String rel)
node
- the node object.index
- the variable index.rel
- the relation attribute.
public List<Object> getReferences(Object node, String rel)
node
- the node object.rel
- the relation attribute.
public boolean isRelated(Object node, String rel, Object pk)
node
- the node object.rel
- the relation attribute.pk
- the primary key value.
public boolean hasNext(Object node, String rel)
node
- the node object.rel
- the relation attribute.
public int depth(Object node, String rel)
node
- the node object.rel
- the relation attribute.
public List<Object> getChain(Object node, String rel)
node
- the node variable.rel
- the relation attribute.
public Map<Object,Object> getMap(Object node, String rel)
node
- the node object.rel
- the relation attribute.
public List<Object> getChain(Object node, String rel, String name)
node
- the node variable.rel
- the relation attribute.name
- the attribute name.
public Map<Object,Object> getMap(Object node, String rel, String name)
node
- the node variable.rel
- the relation attribute.name
- the attribute name.
public Identity toIdentity(String type, Object... pks)
type
- the variable type.pks
- the primary key values.
public Identity toIdentity(Variable var)
var
- the variable.
public Variable getMetaDesktop()
public Variable getMetaFolder()
public boolean isLocalized()
Introspector
isLocalized
in class BeanTool
public VarWriter getVarWriter()
BeanTool
getVarWriter
in class BeanTool
public VarHandler getVarHandler()
BeanTool
getVarHandler
in class BeanTool
protected Variable createVariable(String type) throws ConstructionException
Introspector
createVariable
in class Introspector
type
- the variable type.
ConstructionException
- if construction fails.protected StepFlowContext getCurrentContext()
protected BeanRepositoryFilter getRepositoryFilter()
protected QueryIterator<? extends Variable> iterator(Persister persister, Variable search, DBCriteria<?>... criteria) throws AttributeNotFoundException, PersistenceException
persister
- the persister.search
- the search variable.criteria
- the initial criteria.
AttributeNotFoundException
- for missing attributes.
PersistenceException
- for persister errors.protected int count(Persister persister, Variable search, DBCriteria<?>... criteria) throws AttributeNotFoundException, PersistenceException
persister
- the persister.search
- the search variable.criteria
- the initial criteria.
AttributeNotFoundException
- for missing attributes.
PersistenceException
- for persister errors.protected void closeInternalPersister()
protected Persister getInternalPersister() throws ConstructionException
ConstructionException
- if construction fails.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |