com.groiss.store
Interface Store

All Superinterfaces:
java.rmi.Remote

public interface Store
extends java.rmi.Remote

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.
 void delete(java.lang.Class c, java.lang.String condition, java.lang.Object[] bindVars)
          Deletes some objects from the database.
 void delete(Persistent o)
          Deletes the object from the database.
 void 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.
 Persistent fill(Persistent o)
          Fill objects where only the oid is set.
 Persistent get(java.lang.Class c, long oid)
          Method for getting objects from the database.
 Persistent get(java.lang.Class c, java.lang.String cond)
          Method for getting objects from the database.
 Persistent get(java.lang.Class c, java.lang.String cond, java.lang.Object[] bindVars)
          Method for getting objects from the database.
 Persistent get(java.lang.String classname, long oid)
          Method for getting objects from the database.
 Persistent get(java.lang.String classname, java.lang.String cond)
          Method for getting objects from the database.
 Persistent get(java.lang.String classname, java.lang.String cond, java.lang.Object[] bindVars)
          Method for getting objects from the database.
 Persistent getNoCache(java.lang.Class 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()
           
 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.
 java.util.Vector list(java.lang.Class c)
          This method returns all members of the given class.
 java.util.Vector list(java.lang.Class c, java.lang.String cond)
          This method returns the members of the given class matching the given condition.
 java.util.Vector list(java.lang.Class c, java.lang.String cond, java.lang.String order)
          This method returns the members of the given class matching the given condition.
 java.util.Vector list(java.lang.Class 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.
 java.util.Vector list(java.lang.Class 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.
 java.util.Vector list(java.lang.String classname)
          This method returns all members of the given class.
 java.util.Vector list(java.lang.String classname, java.lang.String cond)
          This method returns the members of the given class matching the given condition.
 java.util.Vector 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.
 java.util.Vector 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.
 java.util.Vector list2(java.lang.Class c, java.lang.String q, java.lang.Object[] bindVars)
          This method returns the members of the given class matching the given condition.
 java.util.Vector 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
 java.util.Hashtable table(java.lang.Class c, java.lang.String cond, java.lang.Object[] bindVars)
          This method returns the members of the given class matching the given condition.
 java.util.Hashtable 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.
 void update(Persistent o)
          Update the database tuple corresponding to the given object.
 

Method Detail

list

java.util.Vector list(java.lang.Class c)
                      throws ApplicationException,
                             java.rmi.RemoteException
This method returns all members of the given class.

Parameters:
c - the class of the objects
Returns:
a vector of members of the given class
Throws:
ApplicationException
java.rmi.RemoteException

list

java.util.Vector list(java.lang.String classname)
                      throws ApplicationException,
                             java.rmi.RemoteException
This method returns all members of the given class.

Parameters:
classname - the name of the class of the object
Returns:
a vector of members of the given class
Throws:
ApplicationException
java.rmi.RemoteException

list

java.util.Vector list(java.lang.Class c,
                      java.lang.String cond)
                      throws ApplicationException,
                             java.rmi.RemoteException
This method returns the members of the given class matching the given condition.

Parameters:
c - the class of the objects
cond - a SQL conditition
Returns:
a vector of members of the given class
Throws:
ApplicationException
java.rmi.RemoteException

list

java.util.Vector list(java.lang.String classname,
                      java.lang.String cond)
                      throws ApplicationException,
                             java.rmi.RemoteException
This method returns the members of the given class matching the given condition.

Parameters:
classname - the name of the class of the object
cond - a SQL conditition
Returns:
a vector of members of the given class
Throws:
ApplicationException
java.rmi.RemoteException

list

java.util.Vector list(java.lang.Class c,
                      java.lang.String cond,
                      java.lang.String order)
                      throws ApplicationException,
                             java.rmi.RemoteException
This method returns the members of the given class matching the given condition.

Parameters:
c - the class of the objects
cond - a SQL conditition
order - a comma separated list of attribute names of the given class.
Returns:
a vector of members of the given class
Throws:
ApplicationException
java.rmi.RemoteException

list

java.util.Vector list(java.lang.String classname,
                      java.lang.String cond,
                      java.lang.String order)
                      throws ApplicationException,
                             java.rmi.RemoteException
This method returns the members of the given class matching the given condition.

Parameters:
classname - the name of the class of the object
cond - a SQL conditition
order - a comma separated list of attribute names of the given class.
Returns:
a vector of members of the given class
Throws:
ApplicationException
java.rmi.RemoteException

list

java.util.Vector list(java.lang.Class c,
                      java.lang.String cond,
                      java.lang.String order,
                      java.lang.Object[] bindVars)
                      throws ApplicationException,
                             java.rmi.RemoteException
This method returns the members of the given class matching the given condition.

Parameters:
c - the class of the objects
cond - a SQL conditition
order - 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
Returns:
a vector of members of the given class
Throws:
ApplicationException
java.rmi.RemoteException

list

java.util.Vector list(java.lang.Class c,
                      java.lang.String cond,
                      java.lang.String order,
                      java.lang.Object[] bindVars,
                      int maxRows)
                      throws ApplicationException,
                             java.rmi.RemoteException
This method returns the members of the given class matching the given condition and limiting the returned entry count.

Parameters:
c - the class of the objects
cond - a SQL conditition
order - 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
maxRows - the maximum number of entries to return
Returns:
a vector of members of the given class
Throws:
ApplicationException
java.rmi.RemoteException

list

java.util.Vector list(java.lang.String classname,
                      java.lang.String cond,
                      java.lang.String order,
                      java.lang.Object[] bindVars)
                      throws ApplicationException,
                             java.rmi.RemoteException
This method returns the members of the given class matching the given condition.

Parameters:
classname - the name of the class of the objects
cond - a SQL conditition
order - 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
Returns:
a vector of members of the given class
Throws:
ApplicationException
java.rmi.RemoteException

list2

java.util.Vector list2(java.lang.Class c,
                       java.lang.String q,
                       java.lang.Object[] bindVars)
                       throws java.rmi.RemoteException
This method returns the members of the given class matching the given condition. the sql-query is a complete sql statement which must retreive exactly the database attributes of the given class, for example: select u.* from avw_user u, avw_userrole ur where ... It is required to use the 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..."

Parameters:
c - the class of the objects
q - a SQL query
bindVars - if the condition contains place holders for binding variables this array should contain the values
Returns:
a vector of members of the given class
Throws:
java.rmi.RemoteException

list2

java.util.Vector list2(java.lang.String classname,
                       java.lang.String q,
                       java.lang.Object[] bindVars)
                       throws java.rmi.RemoteException
This method returns the members of the given class matching the given condition. the sql-query is a complete sql statement which must retreive exactly the database attributes of the given class, for example: select u.* from avw_user u, avw_userrole ur where ... It is required to use the 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..."

Parameters:
classname - the name of the class of the objects
q - a SQL query
bindVars - if the condition contains place holders for binding variables this array should contain the values
Returns:
a vector of members of the given class
Throws:
java.rmi.RemoteException

table

java.util.Hashtable table(java.lang.Class c,
                          java.lang.String cond,
                          java.lang.Object[] bindVars)
                          throws ApplicationException,
                                 java.rmi.RemoteException
This method returns the members of the given class matching the given condition. The keys of the table are the oids of the objects as Long objects, the values are the objects itself.

Parameters:
c - the class of the objects
cond - a SQL conditition
bindVars - if the condition contains place holders for binding variables this array should contain the values
Returns:
a Hashtable of members of the given class
Throws:
ApplicationException
java.rmi.RemoteException

table

java.util.Hashtable table(java.lang.String classname,
                          java.lang.String cond,
                          java.lang.Object[] bindVars)
                          throws ApplicationException,
                                 java.rmi.RemoteException
This method returns the members of the given class matching the given condition. The keys of the table are the oids of the objects as Long objects, the values are the objects itself.

Parameters:
classname - the name of the class of the objects
cond - a SQL conditition
bindVars - if the condition contains place holders for binding variables this array should contain the values
Returns:
a Hashtable of members of the given class
Throws:
ApplicationException
java.rmi.RemoteException

count

int count(java.lang.Class c,
          java.lang.String cond,
          java.lang.Object[] bindVars)
          throws ApplicationException,
                 java.rmi.RemoteException
This method returns the number of members of a given class matching the given condition.

Parameters:
c - the class
cond - a SQL conditition
bindVars - if the condition contains place holders for binding variables this array should contain the values
Returns:
the number of elements
Throws:
ApplicationException
java.rmi.RemoteException

count

int count(java.lang.String classname,
          java.lang.String cond,
          java.lang.Object[] bindVars)
          throws ApplicationException,
                 java.rmi.RemoteException
This method returns the number of members of a given class matching the given condition.

Parameters:
classname - the name of the class
cond - a SQL conditition
bindVars - if the condition contains place holders for binding variables this array should contain the values
Returns:
the number of elements
Throws:
ApplicationException
java.rmi.RemoteException

inDatabase

boolean inDatabase(Persistent o)
                   throws ApplicationException,
                          java.rmi.RemoteException
Check whether the object is in database

Returns:
true if the object is in the database
Throws:
ApplicationException
java.rmi.RemoteException

hasRows

boolean hasRows(java.lang.String stmt,
                java.lang.Object[] bindVars)
                throws ApplicationException,
                       java.rmi.RemoteException
Check whether the statement returns results.

Parameters:
stmt - the SQL statement text.
bindVars - if the stmt contains place holders for binding variables this array should contain the values
Returns:
true if the result set is not empty
Throws:
ApplicationException
java.rmi.RemoteException

get

Persistent get(java.lang.Class c,
               long oid)
               throws ApplicationException,
                      java.rmi.RemoteException
Method for getting objects from the database.

Parameters:
c - the class of the object
oid - the oid of the object
Returns:
the object with a given oid
Throws:
ApplicationException
java.rmi.RemoteException

get

Persistent get(java.lang.String classname,
               long oid)
               throws ApplicationException,
                      java.rmi.RemoteException
Method for getting objects from the database.

Parameters:
classname - the name of the class of the object
oid - the oid of the object
Returns:
the object with a given oid
Throws:
ApplicationException
java.rmi.RemoteException

get

Persistent get(java.lang.Class c,
               java.lang.String cond)
               throws ApplicationException,
                      java.rmi.RemoteException
Method for getting objects from the database.

Parameters:
c - the class of the object
cond - a SQL conditition
Returns:
the object with a given oid
Throws:
ApplicationException
java.rmi.RemoteException

get

Persistent get(java.lang.String classname,
               java.lang.String cond)
               throws ApplicationException,
                      java.rmi.RemoteException
Method for getting objects from the database.

Parameters:
classname - the name of the class of the object
cond - a SQL conditition
Returns:
an object matching the given condition
Throws:
ApplicationException
java.rmi.RemoteException

get

Persistent get(java.lang.Class c,
               java.lang.String cond,
               java.lang.Object[] bindVars)
               throws ApplicationException,
                      java.rmi.RemoteException
Method for getting objects from the database.

Parameters:
c - the class of the object
cond - a SQL conditition
bindVars - if the condition contains place holders for binding variables this array should contain the values
Returns:
an object matching the given condition
Throws:
ApplicationException
java.rmi.RemoteException

get

Persistent get(java.lang.String classname,
               java.lang.String cond,
               java.lang.Object[] bindVars)
               throws ApplicationException,
                      java.rmi.RemoteException
Method for getting objects from the database.

Parameters:
classname - the name of the class of the object
cond - a SQL conditition
bindVars - if the condition contains place holders for binding variables this array should contain the values
Returns:
an object matching the given condition
Throws:
ApplicationException
java.rmi.RemoteException

fill

Persistent fill(Persistent o)
                throws ApplicationException,
                       java.rmi.RemoteException
Fill objects where only the oid is set.

Parameters:
o - the object
Returns:
the same object with fileds set from the database
Throws:
ApplicationException
java.rmi.RemoteException

insert

void insert(Persistent o)
            throws ApplicationException,
                   java.rmi.RemoteException
Insert the object into the database.

Parameters:
o - the object
Throws:
ApplicationException
java.rmi.RemoteException

update

void update(Persistent o)
            throws ApplicationException,
                   java.rmi.RemoteException
Update the database tuple corresponding to the given object.

Parameters:
o - the object
Throws:
ApplicationException
java.rmi.RemoteException

delete

void delete(Persistent o)
            throws ApplicationException,
                   java.rmi.RemoteException
Deletes the object from the database.

Parameters:
o - the object to delete
Throws:
ApplicationException
java.rmi.RemoteException

delete

void delete(java.lang.Class c,
            java.lang.String condition,
            java.lang.Object[] bindVars)
            throws ApplicationException,
                   java.rmi.RemoteException
Deletes some objects from the database.

Parameters:
c - the class of the objects
condition - a SQL conditition
bindVars - if the condition contains place holders for binding variables this array should contain the values
Throws:
ApplicationException
java.rmi.RemoteException

delete

void delete(java.lang.String classname,
            java.lang.String condition,
            java.lang.Object[] bindVars)
            throws ApplicationException,
                   java.rmi.RemoteException
Deletes some objects from the database.

Parameters:
classname - the name of the class of the objects
condition - a SQL conditition
bindVars - if the condition contains place holders for binding variables this array should contain the values
Throws:
ApplicationException
java.rmi.RemoteException

executeStatement

int executeStatement(java.lang.String stmt)
                     throws ApplicationException,
                            java.rmi.RemoteException
Execute a SQL statement.

Parameters:
stmt - the SQL statement text.
Returns:
the number of rows changed
Throws:
ApplicationException
java.rmi.RemoteException

executeStatement

int executeStatement(java.lang.String stmt,
                     java.lang.Object[] bindVars)
                     throws ApplicationException,
                            java.rmi.RemoteException
Execute a SQL statement.

Parameters:
stmt - the SQL statement text.
bindVars - if the stmt contains place holders for binding variables this array should contain the values
Returns:
the number of rows changed
Throws:
ApplicationException
java.rmi.RemoteException

getOID

long getOID()
            throws ApplicationException,
                   java.rmi.RemoteException
Return the next object id from the oid-factory in the database

Returns:
an unique object id
Throws:
ApplicationException
java.rmi.RemoteException

getValue

java.lang.Object getValue(java.lang.String stmt)
                          throws ApplicationException,
                                 java.rmi.RemoteException
Execute a SQL statement which returns one value. The statement is executed, the first row fetched and from the result set the first element is returned.

Parameters:
stmt - the SQL statement text.
Returns:
the value as object.
Throws:
ApplicationException
java.rmi.RemoteException

getValue

java.lang.Object getValue(java.lang.String stmt,
                          int sqlType)
                          throws ApplicationException,
                                 java.rmi.RemoteException
Execute a SQL statement which returns one value. The statement is executed, the first row fetched and from the result set the first element is returned.

Parameters:
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.
Returns:
the value as object.
Throws:
ApplicationException
java.rmi.RemoteException

getValue

java.lang.Object getValue(java.lang.String stmt,
                          java.lang.Object[] bindVars)
                          throws ApplicationException,
                                 java.rmi.RemoteException
Execute a SQL statement which returns one value. The statement is executed, the first row fetched and from the result set the first element is returned.

Parameters:
stmt - the SQL statement text.
bindVars - if the stmt contains place holders for binding variables this array should contain the values
Returns:
the value as object.
Throws:
ApplicationException
java.rmi.RemoteException

getValue

java.lang.Object getValue(java.lang.String stmt,
                          java.lang.Object[] bindVars,
                          int sqlType)
                          throws ApplicationException,
                                 java.rmi.RemoteException
Execute a SQL statement which returns one value. The statement is executed, the first row fetched and from the result set the first element is returned.

Parameters:
stmt - the SQL statement text.
bindVars - if the stmt contains place holders for binding variables this array should contain the values
sqlType - if a special mapping of the database type to java type is needed, the type (java.sql.Types) can be specified here.
Returns:
the value as object.
Throws:
ApplicationException
java.rmi.RemoteException

getTable

javax.swing.table.TableModel getTable(java.lang.String q,
                                      java.lang.Object[] bindVars)
                                      throws java.rmi.RemoteException
Returns the results of the given query.

Parameters:
q - the sql-query
bindVars - if the stmt contains place holders for binding variables this array should contain the values
Returns:
a list of list of values
Throws:
java.rmi.RemoteException

getTable

javax.swing.table.TableModel getTable(java.lang.String q,
                                      java.lang.Object[] bindVars,
                                      int[] sqlTypes)
                                      throws java.rmi.RemoteException
Returns the results of the given query.

Parameters:
q - the sql-query
bindVars - if the stmt contains place holders for binding variables this array should contain the values
sqlTypes - 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.
Returns:
a list of list of values
Throws:
java.rmi.RemoteException

setSchema

void setSchema(java.lang.String schema)
               throws java.rmi.RemoteException
Set the schema of the tables

Parameters:
schema -
Throws:
java.rmi.RemoteException

getSchema

java.lang.String getSchema()
                           throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

getNoCache

Persistent getNoCache(java.lang.Class c,
                      long oid)
                      throws java.lang.Exception
Method for getting objects directly from the database bypassing the cache.

Parameters:
c - the class of the object
oid - the oid of the object
Returns:
the object with a given oid
Throws:
java.lang.Exception


Copyright © 2001-2006 Groiss Informatics GmbH. All Rights Reserved.