com.groiss.store
Class StoreUtil

java.lang.Object
  extended by com.groiss.store.StoreUtil

public class StoreUtil
extends java.lang.Object

Utilities for stores


Constructor Summary
StoreUtil()
           
 
Method Summary
static void addEventHandler(PersistentEventHandler h, java.lang.Class[] classes)
           
static void cleanDbFieldV()
           
static int dbAttrPos(Persistent o, java.lang.String fieldname)
           
static java.lang.String dbAttrs(Persistent o)
           
static java.lang.String dbAttrs(Persistent o, java.lang.String prefix)
           
static int dbAttrsCount(Persistent o)
           
static java.util.Vector dbFields(Persistent o)
          Returns the fields of Object which have corresponding fields in the database.
static java.util.Vector dbMultiValuedFields(Persistent o)
          Returns the multivalued fields (Vectors and Hashtables) of Object which have corresponding fields in the database.
static boolean existsTable(java.lang.String tablename)
          Returns true if the passed table exists in the current db-schema.
static java.math.BigDecimal getBigDecimal(java.sql.ResultSet rs, int columnIndex)
           
static java.math.BigDecimal getBigDecimal(java.sql.ResultSet rs, java.lang.String columnName)
           
static java.util.Date getDate(java.sql.ResultSet rs, int columnIndex)
           
static java.util.Date getDate(java.sql.ResultSet rs, java.lang.String columnName)
           
static java.util.List getEventHandlers(java.lang.Class c)
           
static java.lang.reflect.Field getField(Persistent o, java.lang.String fieldname)
           
static java.lang.Object getFromRS(java.sql.ResultSet rs, int sqlType, int i)
           
static java.lang.Object getFromRS(java.sql.ResultSet rs, java.sql.ResultSetMetaData metaData, int i)
           
static boolean hasClassAttribute(java.lang.Class c)
           
static void removeEventHandler(PersistentEventHandler peh)
           
static void setBigDecimal(java.sql.PreparedStatement stmt, int pos, java.math.BigDecimal value)
           
static void setBindVars(java.sql.PreparedStatement stmt, java.lang.Object[] bindVars)
          Set the bind variables of a prepeared statement based on an object array.
static void setFromDB(Persistent o, java.sql.ResultSet rs)
          Deprecated.  
static void setFromDB(Persistent o, java.sql.ResultSet rs, boolean addToCache)
          Deprecated.  
static void setFromRS(Persistent o, java.sql.ResultSet rs)
          Set the members of the persistent object to the corresponding values of the current row of the result set.
static void setFromRS(Persistent o, java.sql.ResultSet rs, boolean addToCache)
          Set the members of the persistent object to the corresponding values of the current row of the result set.
static void setFromRSByName(Persistent o, java.sql.ResultSet rs)
          Set the members of the persistent object to the corresponding values of the current row of the result set.
static void setFromRSByName(Persistent o, java.sql.ResultSet rs, boolean addToCache)
          Set the members of the persistent object to the corresponding values of the current row of the result set.
static void setValues(Persistent o, java.util.Map req)
           
static void setValues(Persistent o, java.util.Map req, java.util.Map fieldmodes)
           
static java.lang.String toNative(java.lang.String arg)
           
static java.lang.String toNativeScript(java.lang.String arg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoreUtil

public StoreUtil()
Method Detail

dbFields

public static java.util.Vector dbFields(Persistent o)
Returns the fields of Object which have corresponding fields in the database.

Returns:
a vector containing the persistent fields of the class.

dbMultiValuedFields

public static java.util.Vector dbMultiValuedFields(Persistent o)
Returns the multivalued fields (Vectors and Hashtables) of Object which have corresponding fields in the database.

Returns:
a vector containing the persistent multivalued fields of the class.

cleanDbFieldV

public static void cleanDbFieldV()

dbAttrs

public static java.lang.String dbAttrs(Persistent o,
                                       java.lang.String prefix)

dbAttrsCount

public static int dbAttrsCount(Persistent o)

dbAttrs

public static java.lang.String dbAttrs(Persistent o)

hasClassAttribute

public static boolean hasClassAttribute(java.lang.Class c)

dbAttrPos

public static int dbAttrPos(Persistent o,
                            java.lang.String fieldname)

setValues

public static void setValues(Persistent o,
                             java.util.Map req)
                      throws ApplicationException
Throws:
ApplicationException

setValues

public static void setValues(Persistent o,
                             java.util.Map req,
                             java.util.Map fieldmodes)
                      throws ApplicationException
Throws:
ApplicationException

setFromDB

public static void setFromDB(Persistent o,
                             java.sql.ResultSet rs)
                      throws java.lang.Exception
Deprecated. 

Set the members of the persistent object to the corresponding values of the current row of the result set. The object is added to the Thread-Cache. This method normally uses setFromRS. When the property database.setfromdb.compatibility is set in the configuration, setFromRSByName is used.

Parameters:
o - The persistent object
rs - the ResultSet
Throws:
java.lang.Exception

setFromDB

public static void setFromDB(Persistent o,
                             java.sql.ResultSet rs,
                             boolean addToCache)
                      throws java.lang.Exception
Deprecated. 

Set the members of the persistent object to the corresponding values of the current row of the result set. This method nornmally uses setFromRS. When the property database.setfromdb.compatibility is set in the configuration, setFromRSByName is used.

Parameters:
o - The persistent object
rs - the ResultSet
addToCache - if true, the object is added to the Thread-Cache.
Throws:
java.lang.Exception

setFromRSByName

public static void setFromRSByName(Persistent o,
                                   java.sql.ResultSet rs)
                            throws java.lang.Exception
Set the members of the persistent object to the corresponding values of the current row of the result set. The object is added to the Thread-Cache. The method uses a conventional metadata based approach to determine the position and data types of the fields of the ResultSet and is somewhat slower than setFromRS.

Parameters:
o - The persistent object
rs - the ResultSet
Throws:
java.lang.Exception

setFromRSByName

public static void setFromRSByName(Persistent o,
                                   java.sql.ResultSet rs,
                                   boolean addToCache)
                            throws java.lang.Exception
Set the members of the persistent object to the corresponding values of the current row of the result set. The method uses a conventional metadata based approach to determine the position and data types of the fields of the ResultSet and is somewhat slower than setFromRS.

Parameters:
o - The persistent object
rs - the ResultSet
addToCache - if true, the object is added to the Thread-Cache.
Throws:
java.lang.Exception

setFromRS

public static void setFromRS(Persistent o,
                             java.sql.ResultSet rs)
                      throws java.lang.Exception
Set the members of the persistent object to the corresponding values of the current row of the result set. The object is added to the Thread-Cache. The method uses a fast approach to determine the position and data types of the fields of the ResultSet.

Parameters:
o - The persistent object
rs - the ResultSet
Throws:
java.lang.Exception

setFromRS

public static void setFromRS(Persistent o,
                             java.sql.ResultSet rs,
                             boolean addToCache)
                      throws java.lang.Exception
Set the members of the persistent object to the corresponding values of the current row of the result set. The method uses a fast approach to determine the position and data types of the fields of the ResultSet.

Parameters:
o - The persistent object
rs - the ResultSet
addToCache - if true, the object is added to the Thread-Cache.
Throws:
java.lang.Exception

getFromRS

public static java.lang.Object getFromRS(java.sql.ResultSet rs,
                                         java.sql.ResultSetMetaData metaData,
                                         int i)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

getFromRS

public static java.lang.Object getFromRS(java.sql.ResultSet rs,
                                         int sqlType,
                                         int i)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

getField

public static java.lang.reflect.Field getField(Persistent o,
                                               java.lang.String fieldname)

toNativeScript

public static java.lang.String toNativeScript(java.lang.String arg)

toNative

public static java.lang.String toNative(java.lang.String arg)

addEventHandler

public static void addEventHandler(PersistentEventHandler h,
                                   java.lang.Class[] classes)

removeEventHandler

public static void removeEventHandler(PersistentEventHandler peh)

getEventHandlers

public static java.util.List getEventHandlers(java.lang.Class c)

getDate

public static java.util.Date getDate(java.sql.ResultSet rs,
                                     java.lang.String columnName)
                              throws java.sql.SQLException
Throws:
java.sql.SQLException

getDate

public static java.util.Date getDate(java.sql.ResultSet rs,
                                     int columnIndex)
                              throws java.sql.SQLException
Throws:
java.sql.SQLException

getBigDecimal

public static java.math.BigDecimal getBigDecimal(java.sql.ResultSet rs,
                                                 java.lang.String columnName)
                                          throws java.sql.SQLException
Throws:
java.sql.SQLException

getBigDecimal

public static java.math.BigDecimal getBigDecimal(java.sql.ResultSet rs,
                                                 int columnIndex)
                                          throws java.sql.SQLException
Throws:
java.sql.SQLException

setBigDecimal

public static void setBigDecimal(java.sql.PreparedStatement stmt,
                                 int pos,
                                 java.math.BigDecimal value)
                          throws java.sql.SQLException
Throws:
java.sql.SQLException

setBindVars

public static void setBindVars(java.sql.PreparedStatement stmt,
                               java.lang.Object[] bindVars)
Set the bind variables of a prepeared statement based on an object array.

Parameters:
stmt - the prepared statement
bindVars - the array ob bind variables

existsTable

public static boolean existsTable(java.lang.String tablename)
                           throws java.lang.Exception
Returns true if the passed table exists in the current db-schema. The table name will be transformed into upper case for the check.

Parameters:
tablename - the name of the table to be checked.
Returns:
Throws:
java.lang.Exception


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