public class InsertDefaultFactory extends java.lang.Object implements InsertFactory
DBObject.setInsertFactory(InsertFactory)
to activate this class.
The insert default values are applied when the DBObject.dbInsert()
method is called
on a DBObject.
Note that you can change the latter behavior using setApplyValuesInDialog(boolean)
which causes the apply of default values at the time when the RecordEdit dialog is applied.
Note that for Date/Time/Timestamp values you may set the special constant InsertDefaultFactory.CURRENT, which is evaluated to the current time value at runtime.
Constructor and Description |
---|
InsertDefaultFactory(DBRecord anyMasterInPackage) |
InsertDefaultFactory(java.lang.String dboPackageName)
You must provide the name of the package where the
DBObject s are. |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
get(Field inputField)
Gets the value for the given table-column or null if none is specified.
|
java.lang.Object |
get(NlsDatabaseKey nlsKey)
Gets the value for the given table-column or null if none is specified.
|
java.lang.Class |
getDataTypeFor(java.lang.String tableColumn)
Returns the data type of the given table-column of an
DBObject . |
boolean |
isApplyValuesInDialog()
Defines whether the insert-default values should be applied to a DBObject when the record
editor dialog is applied.
|
int |
loadFromDatabase()
Loads the insert default definitions from the insert_def database table.
|
void |
put(DBColumnKey columnKey,
PersistentId insertValue) |
void |
put(Field inputField,
java.lang.Object insertValue)
Strores an insert default value for the given table-column.
|
void |
put(NlsDatabaseKey nlsKey,
java.lang.Object insertValue)
Strores an insert default value for the given table-column.
|
void |
setApplyValuesInDialog(boolean isApplyValuesInDialog)
Tells whether the insert-default values should be applied to a DBObject when the record
editor dialog is applied.
|
public InsertDefaultFactory(java.lang.String dboPackageName)
DBObject
s are.
This is needed in order to find out from the DBO classes (by introspection)
what data types the various table-column have got.dboPackageName
- name of the package where the DBObjects arepublic InsertDefaultFactory(DBRecord anyMasterInPackage)
public boolean isApplyValuesInDialog()
InsertFactory
isApplyValuesInDialog
in interface InsertFactory
public void setApplyValuesInDialog(boolean isApplyValuesInDialog)
InsertFactory
setApplyValuesInDialog
in interface InsertFactory
public java.lang.Object get(Field inputField)
InsertFactory
get
in interface InsertFactory
public java.lang.Object get(NlsDatabaseKey nlsKey)
InsertFactory
get
in interface InsertFactory
public void put(DBColumnKey columnKey, PersistentId insertValue)
public void put(NlsDatabaseKey nlsKey, java.lang.Object insertValue)
InsertFactory
put
in interface InsertFactory
public void put(Field inputField, java.lang.Object insertValue)
InsertFactory
put
in interface InsertFactory
public java.lang.Class getDataTypeFor(java.lang.String tableColumn)
DBObject
.
This type is determined by introspecting the according DBObject class.public int loadFromDatabase() throws java.lang.Exception
java.lang.Exception
Copyright © 2014 EsprIT-Systems. All Rights Reserved.