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
Nested ClassesModifier and TypeClassDescriptionstatic classA column obtained from a database query.static classA 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
ConstructorsModifierConstructorDescriptionprotectedQueryReport(Database database, String name, String sql, Object... params) Construct a new query report.protectedQueryReport(Database database, String name, String sql, Collection<?> params) Construct a new query report. -
Method Summary
Modifier and TypeMethodDescriptionvoidafterQuery(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).voidbeforeQuery(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().booleanChecks if this is a read-only report.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
getDescriptionin interfaceReport
-
getColumnLabel
Gets the label for the provided column. Defaults to column name.- See Also:
-
getParameters
Get default, no parameters are required.- Specified by:
getParametersin 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:
executeReportin 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:
-
