java.lang.Object
com.aoapps.dao.dbc.QueryReport
- All Implemented Interfaces:
Report
A report that is obtained from a SQL query database.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A column obtained from a database query.static class
A result obtained from a database query.Nested classes/interfaces inherited from interface com.aoapps.dao.Report
Report.Alignment, Report.Column, Report.Parameter, Report.Result
-
Constructor Summary
ModifierConstructorDescriptionprotected
QueryReport
(Database database, String name, String sql, Object... params) Construct a new query report.protected
QueryReport
(Database database, String name, String sql, Collection<?> params) Construct a new query report. -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterQuery
(Map<String, ? extends Object> parameterValues, Connection conn) Called in try/finally after the query is executed, this may release any temp tables or views that were setup bybeforeQuery(java.util.Map, java.sql.Connection)
.void
beforeQuery
(Map<String, ? extends Object> parameterValues, Connection conn) Called before the query is executed, this may setup any temp tables or views that are required by the main query.executeReport
(Map<String, ? extends Object> parameterValues) Gets the label for the provided column.getDescription
(Map<String, ? extends Object> parameterValues) Defaults to calling getDescription().getName()
Iterable
<? extends Report.Parameter> Get default, no parameters are required.Defaults to calling getTitle().boolean
Checks if this is a read-only report.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.aoapps.dao.Report
getDescription, getTitle
-
Constructor Details
-
QueryReport
Construct a new query report.- Parameters:
params
- to substitute a parameter, provide the Parameter object.
-
QueryReport
Construct a new query report.- Parameters:
params
- to substitute a parameter, provide the Parameter object.
-
-
Method Details
-
getName
-
getTitle
Defaults to calling getTitle(). -
getDescription
Defaults to calling getDescription().- Specified by:
getDescription
in interfaceReport
-
getColumnLabel
Gets the label for the provided column. Defaults to column name.- See Also:
-
getParameters
Get default, no parameters are required.- Specified by:
getParameters
in interfaceReport
-
isReadOnly
public boolean isReadOnly()Checks if this is a read-only report. No temp tables or views may be created on a read-only report. Defaults to true. -
executeReport
public QueryReport.ReportResult executeReport(Map<String, ? extends Object> parameterValues) throws SQLException- Specified by:
executeReport
in interfaceReport
- Throws:
SQLException
-
beforeQuery
public void beforeQuery(Map<String, ? extends Object> parameterValues, Connection conn) throws SQLExceptionCalled before the query is executed, this may setup any temp tables or views that are required by the main query.This default implementation does nothing.
- Throws:
SQLException
- See Also:
-
afterQuery
public void afterQuery(Map<String, ? extends Object> parameterValues, Connection conn) throws SQLExceptionCalled in try/finally after the query is executed, this may release any temp tables or views that were setup bybeforeQuery(java.util.Map, java.sql.Connection)
. This will be called even when the beforeQuery does not complete fully, and the conn may already be closed or otherwise in an invalid state.This default implementation does nothing.
- Throws:
SQLException
- See Also:
-