public class DbLookup
extends java.lang.Object
| Constructor and Description |
|---|
DbLookup(java.sql.Connection connection)
Creates a new lookup utility with the given connection
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.Integer,java.lang.String> |
addLookup(java.lang.String tableName,
java.lang.String keyColumn,
java.lang.String labelColumn)
Add the lookup table.
|
java.util.Map<java.lang.Integer,java.lang.String> |
addLookup(java.lang.String lookupName,
java.lang.String tableName,
java.lang.String keyColumn,
java.lang.String labelColumn)
Adds the lookup table.
|
int |
findKey(java.lang.String lookupName,
java.lang.String label)
Find the key value.
|
java.lang.String |
getLabel(java.lang.String lookupName,
int key)
Gets the label for the specified key.
|
void |
setConnection(java.sql.Connection connection)
Sets the connection to the JDBC database
|
public DbLookup(java.sql.Connection connection)
connection - the connection to the databasepublic java.util.Map<java.lang.Integer,java.lang.String> addLookup(java.lang.String tableName,
java.lang.String keyColumn,
java.lang.String labelColumn)
tableName - the table namekeyColumn - the key columnlabelColumn - the label columnpublic java.util.Map<java.lang.Integer,java.lang.String> addLookup(java.lang.String lookupName,
java.lang.String tableName,
java.lang.String keyColumn,
java.lang.String labelColumn)
lookupName - the lookup name, used to access the lookup tabletableName - the table name within the databasekeyColumn - the key column within the tablelabelColumn - the label column within the tablepublic int findKey(java.lang.String lookupName,
java.lang.String label)
lookupName - the lookup name, which refers to the tablelabel - the label. This is the string value within the table.public java.lang.String getLabel(java.lang.String lookupName,
int key)
lookupName - the lookup name, which refers to the tablekey - the keypublic void setConnection(java.sql.Connection connection)
connection - the new connection