Esri Geoportal Server
1.0

com.esri.gpt.framework.sql
Class BaseDao

java.lang.Object
  extended by com.esri.gpt.framework.sql.BaseDao
Direct Known Subclasses:
CatalogIndexAdapter, DaoRequest, GptRepository, ImsMetadataAdminDao, ImsPermissionDao, LocalDao, SitemapHandler

public class BaseDao
extends Object

Super-class for a database access object.


Constructor Summary
protected BaseDao()
          Default constructor.
  BaseDao(RequestContext requestContext)
          Constructs with an associated request context.
 
Method Summary
protected  void appendExpression(StringBuffer whereClause, String expression)
          Appends an expression to an SQL where clause.
protected  String appendValueFilter(StringBuffer whereClause, String field, String value, boolean forceLike)
          Appends a value filter to an SQL where clause.
static void closeResultSet(ResultSet rs)
          Closes result set.
static void closeStatement(Statement st)
          Closes a statement.
 ApplicationConfiguration getApplicationConfiguration()
          Gets the application configuration.
 RequestContext getRequestContext()
          Gets the associated request context.
protected  void logExpression(String expression)
          Logs a SQL expression.
protected  ManagedConnection returnConnection()
          Returns a managed connection to the default database.
 void setRequestContext(RequestContext requestContext)
          Sets the associated request context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseDao

protected BaseDao()
Default constructor.


BaseDao

public BaseDao(RequestContext requestContext)
Constructs with an associated request context.

Parameters:
requestContext - the request context
Method Detail

getApplicationConfiguration

public ApplicationConfiguration getApplicationConfiguration()
Gets the application configuration.

Returns:
the application configuration

getRequestContext

public RequestContext getRequestContext()
Gets the associated request context.

Returns:
the request context

setRequestContext

public void setRequestContext(RequestContext requestContext)
Sets the associated request context.

Parameters:
requestContext - the request context

appendExpression

protected void appendExpression(StringBuffer whereClause,
                                String expression)
Appends an expression to an SQL where clause.

Parameters:
whereClause - the where clause
expression - the expression

appendValueFilter

protected String appendValueFilter(StringBuffer whereClause,
                                   String field,
                                   String value,
                                   boolean forceLike)
Appends a value filter to an SQL where clause.

This is intended for use within a PreparedStatement. The appended filter will have the following forms:
field = ?
field LIKE ?

The value returned should be bound within the PreparedStatement:
preparedStatement.setString(n,value)

Parameters:
whereClause - the where clause
field - the field
value - the field value
forceLike - if true force an SQL LIKE
Returns:
the value - possible modified for LIKE (ie. "%"+value+"%")

closeStatement

public static void closeStatement(Statement st)
Closes a statement.

Parameters:
st - the JDBC Statement to close

closeResultSet

public static void closeResultSet(ResultSet rs)
Closes result set.

Parameters:
rs - result set to close

logExpression

protected void logExpression(String expression)
Logs a SQL expression.

Parameters:
expression - the expression to log

returnConnection

protected ManagedConnection returnConnection()
                                      throws SQLException
Returns a managed connection to the default database.

Throws:
SQLException - if an exception occurs while establishing the connection

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.