Class QueryTable
- java.lang.Object
-
- com.identityworksllc.iiq.common.table.QueryTable
-
- All Implemented Interfaces:
StyleTarget
,AutoCloseable
public class QueryTable extends Object implements AutoCloseable, StyleTarget
An extension of Table to run a SQL query and export it.You must provide a Connection (or way of getting one) and a list of column specs.
The meat of the querying takes place in
ResultSetIterator
.
-
-
Constructor Summary
Constructors Constructor Description QueryTable(sailpoint.api.SailPointContext context, Connection connection, String... columns)
Constructs a new QueryTable with the given context and connection, as well as a string list of column tokens.QueryTable(sailpoint.api.SailPointContext context, Connection connection, List<Object> columns)
Constructs a n ew QueryTable with the given context, connection, and column specifications.QueryTable(sailpoint.api.SailPointContext context, Map<String,Object> connectionInfo, String... columns)
Constructs a new QueryTable with the given context and connection info, as well as a string list of column tokens.QueryTable(sailpoint.api.SailPointContext context, Map<String,Object> connectionInfo, List<Object> columns)
Constructs a new QueryTable with the given context and connection info, as well as a string list of column tokens.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryTable
addColumn(Object columnConfig)
Adds an output column to this QueryTablevoid
close()
Closes the connectionQueryTable
executeQuery(String queryString, Map<String,Object> arguments)
Executes the given query with the given options.List<String>
getCssClasses()
Gets the underlying table’s CSS classesString
getStyle()
Gets the CSS style string for this objectString
render()
Renders the table resulting from a queryQueryTable
setColumnCellOptions(int column, CellOption... options)
QueryTable
setColumnStyle(int column, String style)
void
setCssClasses(List<String> cssClasses)
Stores the set of CSS classes attached to this objectQueryTable
setExtraColumnStyle(int column, String style)
QueryTable
setRowCellOptions(int row, CellOption... options)
QueryTable
setRowStyle(int row, String style)
void
setStyle(String style)
Sets the HTML element’s style property of this objectQueryTable
withClass(String... cssClasses)
QueryTable
withHeaderRow(CellOption... options)
-
-
-
Constructor Detail
-
QueryTable
public QueryTable(sailpoint.api.SailPointContext context, Connection connection, List<Object> columns)
Constructs a n ew QueryTable with the given context, connection, and column specifications.The column specs should be some object recognized by the reporting class
ColumnConfig
.- Parameters:
context
- The contextconnection
- The SQL connection, which must be open and ready to querycolumns
- A non-empty list of column specs
-
QueryTable
public QueryTable(sailpoint.api.SailPointContext context, Connection connection, String... columns)
Constructs a new QueryTable with the given context and connection, as well as a string list of column tokens.- Parameters:
context
- The contextconnection
- The SQL connection, which must be open and ready to querycolumns
- A non-empty list of column tokens
-
QueryTable
public QueryTable(sailpoint.api.SailPointContext context, Map<String,Object> connectionInfo, String... columns) throws sailpoint.tools.GeneralException
Constructs a new QueryTable with the given context and connection info, as well as a string list of column tokens.- Parameters:
context
- The contextconnectionInfo
- A map of connection info, with the same keys specified by connectorscolumns
- A non-empty list of column tokens- Throws:
sailpoint.tools.GeneralException
-
QueryTable
public QueryTable(sailpoint.api.SailPointContext context, Map<String,Object> connectionInfo, List<Object> columns) throws sailpoint.tools.GeneralException
Constructs a new QueryTable with the given context and connection info, as well as a string list of column tokens.- Parameters:
context
- The contextconnectionInfo
- A map of connection info, with the same keys specified by connectorscolumns
- A non-empty list of column specs- Throws:
sailpoint.tools.GeneralException
-
-
Method Detail
-
addColumn
public QueryTable addColumn(Object columnConfig)
Adds an output column to this QueryTable- Parameters:
columnConfig
- The column config- Returns:
- This object, for call chaining
-
close
public void close() throws SQLException
Closes the connection- Specified by:
close
in interfaceAutoCloseable
- Throws:
SQLException
- on failure to close the connection
-
executeQuery
public QueryTable executeQuery(String queryString, Map<String,Object> arguments) throws SQLException, sailpoint.tools.GeneralException
Executes the given query with the given options.The query will be run via
NamedParameterStatement
, so the arguments must be of a type recognized by that class.- Parameters:
queryString
- The query string, which must not be null or emptyarguments
- The list of arguments, if any- Returns:
- This object, for call chaining
- Throws:
SQLException
- if any SQL failures occursailpoint.tools.GeneralException
- if any IIQ failures occur
-
getCssClasses
public List<String> getCssClasses()
Gets the underlying table’s CSS classes- Specified by:
getCssClasses
in interfaceStyleTarget
- Returns:
- The set of CSS class names
- See Also:
Element.getCssClasses()
-
getStyle
public String getStyle()
Description copied from interface:StyleTarget
Gets the CSS style string for this object- Specified by:
getStyle
in interfaceStyleTarget
- Returns:
- The CSS style string
- See Also:
Element.getStyle()
-
render
public String render()
Renders the table resulting from a query- Returns:
- The rendered HTML
- See Also:
Table.render()
-
setColumnCellOptions
public QueryTable setColumnCellOptions(int column, CellOption... options) throws sailpoint.tools.GeneralException
- Throws:
sailpoint.tools.GeneralException
- See Also:
Table.setColumnCellOptions(int, CellOption...)
-
setColumnStyle
public QueryTable setColumnStyle(int column, String style)
- See Also:
Table.setColumnStyle(int, String)
-
setCssClasses
public void setCssClasses(List<String> cssClasses)
Description copied from interface:StyleTarget
Stores the set of CSS classes attached to this object- Specified by:
setCssClasses
in interfaceStyleTarget
- Parameters:
cssClasses
- The set of CSS class names- See Also:
Element.setCssClasses(List)
-
setExtraColumnStyle
public QueryTable setExtraColumnStyle(int column, String style)
- See Also:
Table.setExtraColumnStyle(int, String)
-
setRowCellOptions
public QueryTable setRowCellOptions(int row, CellOption... options) throws sailpoint.tools.GeneralException
- Throws:
sailpoint.tools.GeneralException
- See Also:
Table.setRowCellOptions(int, CellOption...)
-
setRowStyle
public QueryTable setRowStyle(int row, String style)
- See Also:
Table.setRowStyle(int, String)
-
setStyle
public void setStyle(String style)
Description copied from interface:StyleTarget
Sets the HTML element’s style property of this object- Specified by:
setStyle
in interfaceStyleTarget
- Parameters:
style
- The CSS style string- See Also:
Element.setStyle(String)
-
withClass
public QueryTable withClass(String... cssClasses)
- See Also:
Table.withClass(String...)
-
withHeaderRow
public QueryTable withHeaderRow(CellOption... options) throws sailpoint.tools.GeneralException
- Throws:
sailpoint.tools.GeneralException
- See Also:
Table.withHeaderRow(CellOption...)
-
-