Class DbRecordSettings

    • Constructor Detail

      • DbRecordSettings

        public DbRecordSettings()
    • Method Detail

      • getThis

        protected DbRecordSettings getThis()
        Description copied from class: BasicSettings
        Returns the exact type of the this reference.
        It's a way to recover the type of the this object in a class hierarchy (cf. getThis "trick").
        Specified by:
        getThis in class BasicSettings<DbRecordSettings>
        Returns:
        The exact type of the this reference
      • dataSource

        public DbRecordSettings dataSource​(java.lang.String dataSource)
        Set the DataSource.
        Parameters:
        dataSource - the name of the data source (eg. "jdbc/TestDB")
        Returns:
        a reference to this object - used to chain calls
      • table

        public DbRecordSettings table​(java.lang.String table)
        Set the DB table on which the query is made.
        Parameters:
        table - the table name to work with.
        Returns:
        a reference to this object - used to chain calls
      • columns

        public DbRecordSettings columns​(java.lang.String columnName,
                                        java.lang.String... columnNames)
        Specify the column names of the DB Table to display in the chooser window.
        Parameters:
        columnName - The first column name
        columnNames - The other column names
        Returns:
        a reference to this object - used to chain calls
        See Also:
        columns(String[])
      • columns

        public DbRecordSettings columns​(java.lang.String[] columnNames)
        Specify the column names of the DB Table to display in the chooser window.
        Parameters:
        columnNames - Array of column names
        Returns:
        a reference to this object - used to chain calls
        See Also:
        table(String)
      • maxRows

        public DbRecordSettings maxRows​(int maxRow)
        Specify the maximum rows to display per result page in the chooser window. Default is 100.
        Parameters:
        maxRow - Number of maximum rows
        Returns:
        a reference to this object - used to chain calls
      • orderBy

        public DbRecordSettings orderBy​(java.lang.String orderBy)
        Specify the order to sort the result-set in ascending or descending order.
        Example: new DBRecordSettings().orderBy("column1, column2 DESC");
        Parameters:
        orderBy - The order
        Returns:
        a reference to this object - used to chain calls
      • chooserValueColumn

        public DbRecordSettings chooserValueColumn​(java.lang.String columnName)
        Column name used to put the value of this column in the hidden field after selecting an item from the database.
        Parameters:
        columnName - Column name
        Returns:
        a reference to this object - used to chain calls
      • chooserLabelColumn

        public DbRecordSettings chooserLabelColumn​(java.lang.String columnName)
        Column name used to display the value of this column in the visible field after selecting an item from the database.
        Parameters:
        columnName - Column name
        Returns:
        a reference to this object - used to chain calls
      • getFirstValue

        public java.lang.Object getFirstValue​(java.lang.String whereValue)
                                       throws java.sql.SQLException
        This convenient method performs a query then it returns the value of the first column of the first row of the result set.
        Parameters:
        whereValue - value in the column defined by the CHOOSER_VALUE_COLUMN option
        Returns:
        The first value or null if no result
        Throws:
        java.sql.SQLException - if an error occurs