Class TableQueryLabelValuesProvider

  • All Implemented Interfaces:
    LabelValuesProvider

    public class TableQueryLabelValuesProvider
    extends Object
    implements LabelValuesProvider
    LabelValuesProvider which retrieves label values from a SQL query on a single database table definition. TableQueryLabelValuesProvider provides easier configuration than a QueryLabelValuesProvider because it constructs the SQL query based on the provided table definition.

    Schema analog: <label_value_query>

    • Constructor Summary

      Constructors 
      Constructor Description
      TableQueryLabelValuesProvider​(String tableDefinition, String columnName)
      Constructs a new TableQueryLabelValuesProvider that returns a list of LabelValues for the given table definition and columnName.
      TableQueryLabelValuesProvider​(String tableDefinition, String labelColumnName, String valueColumnName)
      Constructs a new TableQueryLabelValuesProvider that returns a list of LabelValues for the given table definition, label, and value columns.
      TableQueryLabelValuesProvider​(String tableDefinition, String labelColumnName, String valueColumnName, String groupColumnName)
      Constructs a new TableQueryLabelValuesProvider that returns a list of LabelValues for the given table definition, label, value, and group columns.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      List<LabelValue> createLabelValues​(javax.sql.DataSource dataSource, javax.servlet.http.HttpServletRequest request)
      Returns a List of LabelValue beans to use as values for the parent Column within the Pull Reports Ad Hoc Creator Filter web form.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TableQueryLabelValuesProvider

        public TableQueryLabelValuesProvider​(String tableDefinition,
                                             String columnName)
        Constructs a new TableQueryLabelValuesProvider that returns a list of LabelValues for the given table definition and columnName. The given columnName will be used to construct both the LabelValue label and value. The returned LabelValues will have a the empty Optional as the group value.
        Parameters:
        tableDefinition - The table definition from which to retrieve the label values. Typically, this is the name of a database table (e.g. "schema_name.table_name") but may also be a subquery definition in parenthesis if the database supports subqueries. For example "(select columnX, columnY from schema_name.table_name)".
        columnName - The name of the column in the table definition whose value will be used as both the LabelValue label and value.
      • TableQueryLabelValuesProvider

        public TableQueryLabelValuesProvider​(String tableDefinition,
                                             String labelColumnName,
                                             String valueColumnName)
        Constructs a new TableQueryLabelValuesProvider that returns a list of LabelValues for the given table definition, label, and value columns. The returned LabelValues will have a the empty Optional as the group value.
        Parameters:
        tableDefinition - The table definition from which to retrieve the label values. Typically, this is the name of a database table (e.g. "schema_name.table_name") but may also be a subquery definition in parenthesis if the database supports subqueries. For example "(select columnX, columnY from schema_name.table_name)".
        labelColumnName - The name of the column in the table definition whose value is the LabelValue label.
        valueColumnName - The name of the column in the table definition whose value is the LabelValue value.
      • TableQueryLabelValuesProvider

        public TableQueryLabelValuesProvider​(String tableDefinition,
                                             String labelColumnName,
                                             String valueColumnName,
                                             String groupColumnName)
        Constructs a new TableQueryLabelValuesProvider that returns a list of LabelValues for the given table definition, label, value, and group columns. The returned LabelValues will be ordered by the group value.
        Parameters:
        tableDefinition - The table definition from which to retrieve the label values. Typically, this is the name of a database table (e.g. "schema_name.table_name") but may also be a subquery definition in parenthesis if the database supports subqueries. For example "(select columnX, columnY from schema_name.table_name)".
        labelColumnName - The name of the column in the table definition whose value is the LabelValue label.
        valueColumnName - The name of the column in the table definition whose value is the LabelValue value.
        groupColumnName - The name of the column in the table definition whose value is the LabelValue group.
    • Method Detail

      • createLabelValues

        public List<LabelValue> createLabelValues​(javax.sql.DataSource dataSource,
                                                  javax.servlet.http.HttpServletRequest request)
        Description copied from interface: LabelValuesProvider
        Returns a List of LabelValue beans to use as values for the parent Column within the Pull Reports Ad Hoc Creator Filter web form. The Ad Hoc Creator uses the labels and values within an HTML <select> element associated with the Filter value field.

        The Ad Hoc Creator will surround consecutive LabelValue beans which have equal group properties with an HTML <optgroup> element labeled with the group.

        Specified by:
        createLabelValues in interface LabelValuesProvider
        Parameters:
        dataSource - The DataSource used to fill the parent Report. Use the dataSource to dynamically materialize a list of LabelValue beans from a JDBC query. Any opened JDBC connection must be closed by the implementing method.
        request - The HttpServletRequest sent to the GET Label Value List API. to retrieve the LabelValue list. Use the request parameter to contextualize the returned list to the current user.
        Returns:
        A List of LabelValue beans representing the values of the parent Column.