|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Store
The store interface represents the interface to the database. It is used for inserting, updating, deleting and retrieving objects. You get an object implementing this interface by calling com.groiss.wf.ServiceLocator.getStore() or - in case of RMI - using the getStore() call of com.groiss.wf.Session.
Many methods contain a condition string. The syntax of them is as in an SQL where clause like "name='john' and salary > 1000", where name and salary are database fields of the given object class. In methods where the extra parameter bindVars appears, the condition can contain placeholders, for example "name=? and salary >?".
The condition parameter may always be null, as well as the order parameter. The bindVars may be null if no placeholders are used in the condition.
Method Summary | ||
---|---|---|
int |
count(java.lang.Class<?> c,
java.lang.String cond,
java.lang.Object[] bindVars)
This method returns the number of members of a given class matching the given condition. |
|
int |
count(java.lang.String classname,
java.lang.String cond,
java.lang.Object[] bindVars)
This method returns the number of members of a given class matching the given condition. |
|
int |
delete(java.lang.Class<?> c,
java.lang.String condition,
java.lang.Object[] bindVars)
Deletes some objects from the database. |
|
int |
delete(Persistent o)
Deletes the object from the database. |
|
int |
delete(java.lang.String classname,
java.lang.String condition,
java.lang.Object[] bindVars)
Deletes some objects from the database. |
|
int |
executeStatement(java.lang.String stmt)
Execute a SQL statement. |
|
int |
executeStatement(java.lang.String stmt,
java.lang.Object[] bindVars)
Execute a SQL statement. |
|
|
fill(P o)
Fill objects where only the oid is set. |
|
|
fillByField(java.lang.Class<? extends P> c,
java.util.Collection<R> collection,
java.lang.String fieldname)
Fill a heterogeneous set of Persistents referenced via a field of a collection of (persistent) objects. |
|
|
fillByField(java.lang.Class<? extends P> c,
java.util.Collection<R> collection,
java.lang.String fieldname,
java.lang.String condition,
java.lang.Object[] bindVars)
Fill a heterogeneous set of Persistents referenced via a field of a collection of (persistent) objects. |
|
|
get(java.lang.Class<? extends P> c,
long oid)
Method for getting objects from the database. |
|
|
get(java.lang.Class<? extends P> c,
java.lang.String cond)
Method for getting objects from the database. |
|
|
get(java.lang.Class<? extends P> c,
java.lang.String cond,
java.lang.Object[] bindVars)
Method for getting objects from the database. |
|
|
get(java.lang.String classname,
long oid)
Method for getting objects from the database. |
|
|
get(java.lang.String classname,
java.lang.String cond)
Method for getting objects from the database. |
|
|
get(java.lang.String classname,
java.lang.String cond,
java.lang.Object[] bindVars)
Method for getting objects from the database. |
|
|
getNoCache(java.lang.Class<? extends P> c,
long oid)
Method for getting objects directly from the database bypassing the cache. |
|
long |
getOID()
Return the next object id from the oid-factory in the database |
|
java.lang.String |
getSchema()
Returns the schema of the tables |
|
javax.swing.table.TableModel |
getTable(java.lang.String q,
java.lang.Object[] bindVars)
Returns the results of the given query. |
|
javax.swing.table.TableModel |
getTable(java.lang.String q,
java.lang.Object[] bindVars,
int[] sqlTypes)
Returns the results of the given query. |
|
java.lang.Object |
getValue(java.lang.String stmt)
Execute a SQL statement which returns one value. |
|
java.lang.Object |
getValue(java.lang.String stmt,
int sqlType)
Execute a SQL statement which returns one value. |
|
java.lang.Object |
getValue(java.lang.String stmt,
java.lang.Object[] bindVars)
Execute a SQL statement which returns one value. |
|
java.lang.Object |
getValue(java.lang.String stmt,
java.lang.Object[] bindVars,
int sqlType)
Execute a SQL statement which returns one value. |
|
boolean |
hasRows(java.lang.String stmt,
java.lang.Object[] bindVars)
Check whether the statement returns results. |
|
boolean |
inDatabase(Persistent o)
Check whether the object is in database |
|
void |
insert(Persistent o)
Insert the object into the database. |
|
|
list(java.lang.Class<? extends P> c)
This method returns all members of the given class. |
|
|
list(java.lang.Class<? extends P> c,
java.lang.String cond)
This method returns the members of the given class matching the given condition. |
|
|
list(java.lang.Class<? extends P> c,
java.lang.String cond,
java.lang.String order)
This method returns the members of the given class matching the given condition. |
|
|
list(java.lang.Class<? extends P> c,
java.lang.String cond,
java.lang.String order,
java.lang.Object[] bindVars)
This method returns the members of the given class matching the given condition. |
|
|
list(java.lang.Class<? extends P> c,
java.lang.String cond,
java.lang.String order,
java.lang.Object[] bindVars,
int maxRows)
This method returns the members of the given class matching the given condition and limiting the returned entry count. |
|
|
list(java.lang.String classname)
This method returns all members of the given class. |
|
|
list(java.lang.String classname,
java.lang.String cond)
This method returns the members of the given class matching the given condition. |
|
|
list(java.lang.String classname,
java.lang.String cond,
java.lang.String order)
This method returns the members of the given class matching the given condition. |
|
|
list(java.lang.String classname,
java.lang.String cond,
java.lang.String order,
java.lang.Object[] bindVars)
This method returns the members of the given class matching the given condition. |
|
|
list2(java.lang.Class<? extends P> c,
java.lang.String q,
java.lang.Object[] bindVars)
This method returns the members of the given class matching the given condition. |
|
|
list2(java.lang.String classname,
java.lang.String q,
java.lang.Object[] bindVars)
This method returns the members of the given class matching the given condition. |
|
void |
setSchema(java.lang.String schema)
Set the schema of the tables |
|
|
table(java.lang.Class<? extends P> c,
java.lang.String cond,
java.lang.Object[] bindVars)
This method returns the members of the given class matching the given condition. |
|
|
table(java.lang.String classname,
java.lang.String cond,
java.lang.Object[] bindVars)
This method returns the members of the given class matching the given condition. |
|
int |
update(Persistent o)
Update the database tuple corresponding to the given object. |
|
int |
update(Persistent o,
java.lang.String... fieldNames)
Update some fields of the database tuple corresponding to the given object. |
Method Detail |
---|
<P> java.util.List<P> list(java.lang.Class<? extends P> c)
list
in interface RemoteStore
c
- the class of the objects
<P extends Persistent> java.util.List<P> list(java.lang.String classname)
list
in interface RemoteStore
classname
- the name of the class of the object
<P> java.util.List<P> list(java.lang.Class<? extends P> c, java.lang.String cond)
list
in interface RemoteStore
c
- the class of the objectscond
- a SQL condition
<P extends Persistent> java.util.List<P> list(java.lang.String classname, java.lang.String cond)
list
in interface RemoteStore
classname
- the name of the class of the objectcond
- a SQL condition
<P> java.util.List<P> list(java.lang.Class<? extends P> c, java.lang.String cond, java.lang.String order)
list
in interface RemoteStore
c
- the class of the objectscond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.
<P extends Persistent> java.util.List<P> list(java.lang.String classname, java.lang.String cond, java.lang.String order)
list
in interface RemoteStore
classname
- the name of the class of the objectcond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.
<P> java.util.List<P> list(java.lang.Class<? extends P> c, java.lang.String cond, java.lang.String order, java.lang.Object[] bindVars)
list
in interface RemoteStore
c
- the class of the objectscond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.bindVars
- if the condition contains place holders for binding variables this array should contain the values
<P> java.util.List<P> list(java.lang.Class<? extends P> c, java.lang.String cond, java.lang.String order, java.lang.Object[] bindVars, int maxRows)
list
in interface RemoteStore
c
- the class of the objectscond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.bindVars
- if the condition contains place holders for binding variables this array should contain the valuesmaxRows
- the maximum number of entries to return
<P extends Persistent> java.util.List<P> list(java.lang.String classname, java.lang.String cond, java.lang.String order, java.lang.Object[] bindVars)
list
in interface RemoteStore
classname
- the name of the class of the objectscond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.bindVars
- if the condition contains place holders for binding variables this array should contain the values
<P> java.util.List<P> list2(java.lang.Class<? extends P> c, java.lang.String q, java.lang.Object[] bindVars)
StoreUtil.dbAttrs(Persistent, String)
dbAttrs(String) method to construct the attribute list,
that is to formulate "select "+StoreUtil.dbAttrs(user,"u")+" from avwuser u, avw_userrole ur where..."
list2
in interface RemoteStore
c
- the class of the objectsq
- a SQL querybindVars
- if the condition contains place holders for binding variables this array should contain the values
<P extends Persistent> java.util.List<P> list2(java.lang.String classname, java.lang.String q, java.lang.Object[] bindVars)
StoreUtil.dbAttrs(Persistent, String)
dbAttrs(String) method to construct the attribute list,
that is to formulate "select "+StoreUtil.dbAttrs(user,"u")+" from avwuser u, avw_userrole ur where..."
list2
in interface RemoteStore
classname
- the name of the class of the objectsq
- a SQL querybindVars
- if the condition contains place holders for binding variables this array should contain the values
<P> java.util.Map<java.lang.Long,P> table(java.lang.Class<? extends P> c, java.lang.String cond, java.lang.Object[] bindVars)
table
in interface RemoteStore
c
- the class of the objectscond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this array should contain the values
<P extends Persistent> java.util.Map<java.lang.Long,P> table(java.lang.String classname, java.lang.String cond, java.lang.Object[] bindVars)
table
in interface RemoteStore
classname
- the name of the class of the objectscond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this array should contain the values
int count(java.lang.Class<?> c, java.lang.String cond, java.lang.Object[] bindVars)
count
in interface RemoteStore
c
- the classcond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this array should contain the values
int count(java.lang.String classname, java.lang.String cond, java.lang.Object[] bindVars)
count
in interface RemoteStore
classname
- the name of the classcond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this array should contain the values
boolean inDatabase(Persistent o)
inDatabase
in interface RemoteStore
boolean hasRows(java.lang.String stmt, java.lang.Object[] bindVars)
hasRows
in interface RemoteStore
stmt
- the SQL statement text.bindVars
- if the stmt contains place holders for binding variables this array should contain the values
<P> P get(java.lang.Class<? extends P> c, long oid)
get
in interface RemoteStore
c
- the class of the objectoid
- the oid of the object
<P extends Persistent> P get(java.lang.String classname, long oid)
get
in interface RemoteStore
classname
- the name of the class of the objectoid
- the oid of the object
<P> P get(java.lang.Class<? extends P> c, java.lang.String cond)
get
in interface RemoteStore
c
- the class of the objectcond
- a SQL condition
<P extends Persistent> P get(java.lang.String classname, java.lang.String cond)
get
in interface RemoteStore
classname
- the name of the class of the objectcond
- a SQL condition
<P> P get(java.lang.Class<? extends P> c, java.lang.String cond, java.lang.Object[] bindVars)
get
in interface RemoteStore
c
- the class of the objectcond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this array should contain the values
<P extends Persistent> P get(java.lang.String classname, java.lang.String cond, java.lang.Object[] bindVars)
get
in interface RemoteStore
classname
- the name of the class of the objectcond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this array should contain the values
<P> P fill(P o)
fill
in interface RemoteStore
o
- the object
<P extends Persistent,R extends Persistent> java.util.Set<P> fillByField(java.lang.Class<? extends P> c, java.util.Collection<R> collection, java.lang.String fieldname)
fillByField
in interface RemoteStore
c
- (super)class of the referenced Objectscollection
- the Collection of referencing objects, must all be filled.
<P extends Persistent,R extends Persistent> java.util.Set<P> fillByField(java.lang.Class<? extends P> c, java.util.Collection<R> collection, java.lang.String fieldname, java.lang.String condition, java.lang.Object[] bindVars)
fillByField
in interface RemoteStore
c
- (super)class of the referenced Objectscollection
- the Collection of referencing objects, must all be filled.condition
- an optional SQL condition.bindVars
- optional array of parameter bindings for the SQL statement.
void insert(Persistent o)
insert
in interface RemoteStore
o
- the objectint update(Persistent o)
update
in interface RemoteStore
o
- the objectint update(Persistent o, java.lang.String... fieldNames)
update
in interface RemoteStore
o
- the objectfieldNames
- an array containing the names of the fields which should be updatedint delete(Persistent o)
delete
in interface RemoteStore
o
- the object to delete
int delete(java.lang.Class<?> c, java.lang.String condition, java.lang.Object[] bindVars)
Persistent.onDelete()
nor PersistentEventHandler.onDelete(Persistent)
methods
are called for the individual deleted objects.
delete
in interface RemoteStore
c
- the class of the objectscondition
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this array should contain the values
int delete(java.lang.String classname, java.lang.String condition, java.lang.Object[] bindVars)
Persistent.onDelete()
nor PersistentEventHandler.onDelete(Persistent)
methods
are called for the individual deleted objects.
delete
in interface RemoteStore
classname
- the name of the class of the objectscondition
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this array should contain the values
int executeStatement(java.lang.String stmt)
executeStatement
in interface RemoteStore
stmt
- the SQL statement text.
int executeStatement(java.lang.String stmt, java.lang.Object[] bindVars)
executeStatement
in interface RemoteStore
stmt
- the SQL statement text.bindVars
- if the stmt contains place holders for binding variables this array should contain the values
long getOID()
getOID
in interface RemoteStore
java.lang.Object getValue(java.lang.String stmt)
getValue
in interface RemoteStore
stmt
- the SQL statement text.
java.lang.Object getValue(java.lang.String stmt, int sqlType)
getValue
in interface RemoteStore
stmt
- the SQL statement text.sqlType
- if a special mapping of the database type to java type is needed, the type (java.sql.Types)
can be specified here.
java.lang.Object getValue(java.lang.String stmt, java.lang.Object[] bindVars)
getValue
in interface RemoteStore
stmt
- the SQL statement text.bindVars
- if the stmt contains place holders for binding variables this array should contain the values
java.lang.Object getValue(java.lang.String stmt, java.lang.Object[] bindVars, int sqlType)
getValue
in interface RemoteStore
stmt
- the SQL statement text.bindVars
- if the stmt contains place holders for binding variables this array should contain the valuessqlType
- if a special mapping of the database type to java type is needed, the type (java.sql.Types)
can be specified here.
javax.swing.table.TableModel getTable(java.lang.String q, java.lang.Object[] bindVars)
getTable
in interface RemoteStore
q
- the sql-querybindVars
- if the query contains place holders for binding variables this array should contain the values
javax.swing.table.TableModel getTable(java.lang.String q, java.lang.Object[] bindVars, int[] sqlTypes)
getTable
in interface RemoteStore
q
- the sql-querybindVars
- if the query contains place holders for binding variables this array should contain the valuessqlTypes
- if a special mapping of database types to java types is needed, the types (java.sql.Types)
can be specified here. The length of the array must be equal to the number of columns in the result set.
void setSchema(java.lang.String schema)
setSchema
in interface RemoteStore
java.lang.String getSchema()
getSchema
in interface RemoteStore
<P> P getNoCache(java.lang.Class<? extends P> c, long oid)
getNoCache
in interface RemoteStore
c
- the class of the objectoid
- the oid of the object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |