Class DbRecordSettings
- java.lang.Object
-
- com.jalios.jcms.taglib.settings.BasicSettings<T>
-
- com.jalios.jcms.taglib.settings.AbstractTextSettings<T>
-
- com.jalios.jcms.taglib.settings.AbstractTextChooserSettings<DbRecordSettings>
-
- com.jalios.jcms.taglib.settings.impl.DbRecordSettings
-
- All Implemented Interfaces:
ControlSettings<DbRecordSettings>
,java.lang.Cloneable
public class DbRecordSettings extends AbstractTextChooserSettings<DbRecordSettings>
DBRecord Settings- Author:
- Nicolas Dos Santos
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CHOOSER_LABEL_COLUMN
static java.lang.String
CHOOSER_VALUE_COLUMN
static java.lang.String
COLUMNS
static java.lang.String
DATA_SOURCE
static int
DEFAULT_MAX_ROWS
static java.lang.String
MAX_ROWS
static java.lang.String
ORDER_BY
static java.lang.String
TABLE
-
Fields inherited from class com.jalios.jcms.taglib.settings.BasicSettings
APPEND, ARIA_ATTR_PREFIX, ARIA_ATTRIBUTES, AUTOFOCUS, CLEAR_BUTTON, CSS, DATA_ATTR_PREFIX, DATA_ATTRIBUTES, DISABLED, HIDE_CLEAR_BUTTON, HTML_ATTRIBUTES, ID, LANGUAGE_CHOOSER, MAX_LENGTH, NAME, PLACEHOLDER, PREPEND, READONLY, REQUIRED, TITLE, TRIGGER_ACTION, TRIGGER_EVENT, VALUE
-
-
Constructor Summary
Constructors Constructor Description DbRecordSettings()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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.DbRecordSettings
columns(java.lang.String[] columnNames)
Specify the column names of the DB Table to display in the chooser window.DbRecordSettings
columns(java.lang.String columnName, java.lang.String... columnNames)
Specify the column names of the DB Table to display in the chooser window.DbRecordSettings
dataSource(java.lang.String dataSource)
Set the DataSource.protected java.lang.String
getChooserName()
Chooser name used by the databroker when there is a click event in the chooser button.protected java.lang.String
getChooserOption(java.util.Map<java.lang.String,java.lang.String[]> customOptionMap)
Options used by the databroker when there is a click event in the chooser button.java.lang.Object
getFirstValue(java.lang.String whereValue)
This convenient method performs a query then it returns the value of the first column of the first row of the result set.protected DbRecordSettings
getThis()
Returns the exact type of the this reference.
It's a way to recover the type of thethis
object in a class hierarchy (cf.ControlType
getType()
Returns theControlType
related to the currentControlSettings
implementation.DbRecordSettings
maxRows(int maxRow)
Specify the maximum rows to display per result page in the chooser window.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");
void
resolveOptions(TypeFieldEntry tfe)
Set options from the specifiedTypeFieldEntry
.DbRecordSettings
table(java.lang.String table)
Set the DB table on which the query is made.-
Methods inherited from class com.jalios.jcms.taglib.settings.AbstractTextChooserSettings
addAcChooserOption, addChooserOption, getAcChooserName, getAcChooserOption, getChooserIcon, getChooserTitle, getOption, popupHeight, popupWidth, superGetOption, useCurrentWorkspace, workspace, workspace
-
Methods inherited from class com.jalios.jcms.taglib.settings.AbstractTextSettings
onChange
-
Methods inherited from class com.jalios.jcms.taglib.settings.BasicSettings
addOption, append, aria, aria, autofocus, clearOption, clone, css, dataAttribute, dataAttributes, disable, getOptionNames, htmlAttributes, htmlAttributes, id, isChannelReady, maxLength, merge, name, onFocusOut, placeholder, prepend, readonly, removeOption, require, showLanguageChooser, sortSet, title, toStringArray, toStringArray, toStringArray, toStringArray, toStringArray, trigger, value
-
-
-
-
Field Detail
-
DEFAULT_MAX_ROWS
public static final int DEFAULT_MAX_ROWS
- See Also:
- Constant Field Values
-
DATA_SOURCE
public static final java.lang.String DATA_SOURCE
- See Also:
- Constant Field Values
-
TABLE
public static final java.lang.String TABLE
- See Also:
- Constant Field Values
-
COLUMNS
public static final java.lang.String COLUMNS
- See Also:
- Constant Field Values
-
MAX_ROWS
public static final java.lang.String MAX_ROWS
- See Also:
- Constant Field Values
-
ORDER_BY
public static final java.lang.String ORDER_BY
- See Also:
- Constant Field Values
-
CHOOSER_VALUE_COLUMN
public static final java.lang.String CHOOSER_VALUE_COLUMN
- See Also:
- Constant Field Values
-
CHOOSER_LABEL_COLUMN
public static final java.lang.String CHOOSER_LABEL_COLUMN
- See Also:
- Constant Field Values
-
-
Method Detail
-
getType
public ControlType getType()
Description copied from interface:ControlSettings
Returns theControlType
related to the currentControlSettings
implementation.- Returns:
ControlType
-
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 thethis
object in a class hierarchy (cf. getThis "trick").- Specified by:
getThis
in classBasicSettings<DbRecordSettings>
- Returns:
- The exact type of the this reference
-
resolveOptions
public void resolveOptions(TypeFieldEntry tfe)
Description copied from interface:ControlSettings
Set options from the specifiedTypeFieldEntry
.- Specified by:
resolveOptions
in interfaceControlSettings<DbRecordSettings>
- Overrides:
resolveOptions
in classBasicSettings<DbRecordSettings>
- Parameters:
tfe
-TypeFieldEntry
-
getChooserName
protected java.lang.String getChooserName()
Description copied from class:AbstractTextChooserSettings
Chooser name used by the databroker when there is a click event in the chooser button.- Specified by:
getChooserName
in classAbstractTextChooserSettings<DbRecordSettings>
- Returns:
- The chooser name
- See Also:
- "/js/jalios/core/jalios-widget-chooser.js"
-
getChooserOption
protected java.lang.String getChooserOption(java.util.Map<java.lang.String,java.lang.String[]> customOptionMap)
Description copied from class:AbstractTextChooserSettings
Options used by the databroker when there is a click event in the chooser button.- Specified by:
getChooserOption
in classAbstractTextChooserSettings<DbRecordSettings>
- Parameters:
customOptionMap
- Extra chooser options forwarded by the optionChooserConstants.EXTRA_CHOOSER_OPTION
and appended to the query string- Returns:
String
representing the options as query string
-
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 namecolumnNames
- 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 theCHOOSER_VALUE_COLUMN
option- Returns:
- The first value or null if no result
- Throws:
java.sql.SQLException
- if an error occurs
-
-