|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.instantbank.common.utilcomponents.DAOUtil
This utility class for EJB tier components.
| Constructor Summary | |
DAOUtil()
|
|
| Method Summary | |
static void |
closeCallableStatement(java.sql.CallableStatement cstmt)
Close a CallableStatement |
static void |
closeConnection(java.sql.Connection dbConnection)
Close database connection associated to dbConnection attribute |
static void |
closePreparedStatement(java.sql.PreparedStatement stmt)
Close a PreparedStatement statement |
static void |
closeResultSet(java.sql.ResultSet result)
Close a resultSet |
static void |
closeStatement(java.sql.Statement stmt)
Close a statement |
static byte[] |
getBlobImage(java.sql.Blob blobRef,
byte[] imageArray)
Get BLOB image from DB |
static java.sql.Blob |
getBlobReference(java.sql.PreparedStatement ps,
java.sql.ResultSet rs)
Obtain reference to BLOB field in the DB |
static java.lang.String |
getBlobText(java.sql.Blob blobRef,
byte[] textArray)
Get BLOB text from DB |
static javax.sql.DataSource |
getDataSource(java.lang.String dsName)
Get the DataSource associated to a JNDIName |
static java.sql.Connection |
getDBConnection(javax.sql.DataSource datasource)
Get a database connection |
static java.lang.String |
getUserId(javax.ejb.SessionContext context)
get the current user from the context |
static int |
inputStreamTobyte(java.io.InputStream is,
byte[] array,
byte[] buf)
Get byte[] from InputStream |
static boolean |
isUserInRole(javax.ejb.SessionContext context,
java.lang.String rol)
determine if the current user belongs to a role |
static CodeDescription[] |
loadCodeDescription(java.sql.PreparedStatement ps,
java.sql.ResultSet rs)
Auxiliary for load a CodeDescription[] from DB |
static void |
showByteArray(byte[] array)
Debug: Shows first and last bytes of a byte[] |
static void |
writeBlobData(java.sql.Blob blobRef,
java.io.InputStream is)
Write BLOB data on the DB |
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
public DAOUtil()
| Method Detail |
public static java.lang.String getUserId(javax.ejb.SessionContext context)
throws java.lang.Exception
context - is the contextjava.lang.Exception -
public static boolean isUserInRole(javax.ejb.SessionContext context,
java.lang.String rol)
throws java.lang.Exception
context - is the contextrol - role of sistemjava.lang.Exception -
public static javax.sql.DataSource getDataSource(java.lang.String dsName)
throws DAOException
dsName - Description of the ParameterDAOException -
public static java.sql.Connection getDBConnection(javax.sql.DataSource datasource)
throws DAOException
datasource - Description of the ParameterDAOException -
public static void closeConnection(java.sql.Connection dbConnection)
throws DAOException
dbConnection - Description of the ParameterDAOException -
public static void closeResultSet(java.sql.ResultSet result)
throws DAOException
result - is the ResultSet to closeDAOException -
public static void closeStatement(java.sql.Statement stmt)
throws DAOException
stmt - is the Statement to closeDAOException -
public static void closePreparedStatement(java.sql.PreparedStatement stmt)
throws DAOException
stmt - is the PreparedStatement to closeDAOException -
public static void closeCallableStatement(java.sql.CallableStatement cstmt)
throws DAOException
cstmt - is the PreparedStatement to closeDAOException -
public static CodeDescription[] loadCodeDescription(java.sql.PreparedStatement ps,
java.sql.ResultSet rs)
throws java.lang.Exception
ps - auxiliary PreparedStatementrs - auxiliary ResultSetjava.lang.Exception -
public static java.sql.Blob getBlobReference(java.sql.PreparedStatement ps,
java.sql.ResultSet rs)
throws java.lang.Exception
ps - auxiliary PreparedStatementrs - auxiliary ResultSetjava.lang.Exception -
public static void writeBlobData(java.sql.Blob blobRef,
java.io.InputStream is)
throws java.lang.Exception
blobRef - reference to a Blob fieldis - data (InputStream) to write in the Blob fieldjava.lang.Exception -
public static java.lang.String getBlobText(java.sql.Blob blobRef,
byte[] textArray)
throws java.lang.Exception
blobRef - reference to a Blob text fieldtextArray - is an auxiliary byte[] to receive the text
from the Blob fieldjava.lang.Exception -
public static byte[] getBlobImage(java.sql.Blob blobRef,
byte[] imageArray)
throws java.lang.Exception
blobRef - reference to a Blob text fieldimageArray - is an auxiliary byte[] to receive the image from
the Blob fieldjava.lang.Exception -
public static int inputStreamTobyte(java.io.InputStream is,
byte[] array,
byte[] buf)
is - InputStreamarray - byte[] for storing all the bytes of isbuf - auxiliary byte[] for reading from ispublic static void showByteArray(byte[] array)
array - array of bytes
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||