|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softslate.commerce.daos.core.BaseDAO
Abstract superclass for all objects in the data access layer.
The methods provided allow implementations to communicate with other elements
of the application. In particular, retrieve settings (using
getSettingsBean()
), retrieve database connections (using
getConnection()
), retrieve SQL statements (using
getSqlMap()
and getSQL(java.lang.String, java.lang.String)
), and create other data
access objects (using getDaoFactory()
).
Field Summary | |
private java.sql.Connection |
connection
|
private DAOFactory |
daoFactory
|
private javax.sql.DataSource |
dataSource
|
(package private) static org.apache.commons.logging.Log |
log
|
private SettingsBean |
settingsBean
|
private java.util.Map |
sqlMap
|
Constructor Summary | |
BaseDAO()
|
Method Summary | |
java.lang.String |
formatDateTime(java.util.Date dateTime)
Formats a Date object into a string suitable for storage in the database. |
java.sql.Connection |
getConnection()
Retrieves a Connection to the application's
DataSource . |
DAOFactory |
getDaoFactory()
Retrieves the application's DAOFactory . |
javax.sql.DataSource |
getDataSource()
Retrieves the application's DataSource . |
SettingsBean |
getSettingsBean()
Retrieves the SettingsBean previously set for this data
access object. |
java.lang.String |
getSQL(java.lang.String module,
java.lang.String key)
Returns an SQL statement configured in the .properties files under "/WEB-INF/classes/resources". |
java.util.Map |
getSqlMap()
Retrieves a Map of the SQL statements used by the
application. |
void |
initialize(java.util.Map transferMap)
Initializes this data access object by copying incoming parameters into its properties. |
java.util.Date |
parseDateTime(java.lang.String dateTime)
Formats a Date object into a string suitable for storage in the database. |
void |
setConnection(java.sql.Connection connection)
|
void |
setDaoFactory(DAOFactory daoFactory)
|
void |
setDataSource(javax.sql.DataSource dataSource)
|
void |
setSettingsBean(SettingsBean settingsBean)
|
void |
setSqlMap(java.util.Map sqlMap)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static org.apache.commons.logging.Log log
private SettingsBean settingsBean
private javax.sql.DataSource dataSource
private java.sql.Connection connection
private java.util.Map sqlMap
private DAOFactory daoFactory
Constructor Detail |
public BaseDAO()
Method Detail |
public SettingsBean getSettingsBean()
DAOInterface
SettingsBean
previously set for this data
access object.
getSettingsBean
in interface DAOInterface
SettingsBean
object that represents various
settings for the system.public void setSettingsBean(SettingsBean settingsBean)
setSettingsBean
in interface DAOInterface
public javax.sql.DataSource getDataSource()
DAOInterface
DataSource
.
getDataSource
in interface DAOInterface
DataSource
.public void setDataSource(javax.sql.DataSource dataSource)
setDataSource
in interface DAOInterface
public java.sql.Connection getConnection()
DAOInterface
Connection
to the application's
DataSource
.
getConnection
in interface DAOInterface
Connection
to the application's
DataSource
.public void setConnection(java.sql.Connection connection)
setConnection
in interface DAOInterface
public java.util.Map getSqlMap()
DAOInterface
Map
of the SQL statements used by the
application.
getSqlMap
in interface DAOInterface
Map
of the SQL statements used by the
application.public void setSqlMap(java.util.Map sqlMap)
setSqlMap
in interface DAOInterface
public DAOFactory getDaoFactory()
DAOInterface
DAOFactory
.
getDaoFactory
in interface DAOInterface
DAOFactory
.public void setDaoFactory(DAOFactory daoFactory)
setDaoFactory
in interface DAOInterface
public void initialize(java.util.Map transferMap) throws java.lang.Exception
DAOInterface
DAOFactory
after object
creation to copy the application's
DAOFactory
and
SettingsBean
into
the new object. The sqlMap
and dataSource
properties are also copied from the DAOFactory
.
initialize
in interface DAOInterface
transferMap
- A Map
containing objects such as the
application's DAOFactory
and
SettingsBean
.
java.lang.Exception
public java.lang.String getSQL(java.lang.String module, java.lang.String key) throws java.lang.Exception
module
- The application module corresponding to the desired SQL
statement, such as "core", "product", "order", or "customer".key
- A string key for the SQL statement corresponding to the keys
in the .properties files.
null
if the requested
statement could not be found.
java.lang.Exception
public java.lang.String formatDateTime(java.util.Date dateTime)
dateTime
-
public java.util.Date parseDateTime(java.lang.String dateTime) throws java.lang.Exception
dateTime
-
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |