agonism.dovetail.site
Class NewRecord
java.lang.Object
|
+--agonism.dovetail.site.NewRecord
- public class NewRecord
- extends java.lang.Object
Field Summary |
static org.log4j.Category |
C
|
Constructor Summary |
NewRecord(java.lang.String tableName)
Insert a new record into a named table. |
NewRecord(Table table)
Insert a new record into Table. |
Method Summary |
boolean |
create(java.sql.Connection c,
Form form,
agonism.dovetail.db.IParameterSource source)
Create the new record. |
boolean |
create(Form form)
Create a new record from a Form. |
int |
getLastInsertID()
Get the last rowID that was generated by a call to the create(agonism.dovetail.site.Form) method. |
void |
setRethrow(boolean b)
Set whether any DuplicateKeyException or InvalidValueException will
be re-thrown by this NewRecord instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
C
public static final org.log4j.Category C
NewRecord
public NewRecord(java.lang.String tableName)
- Insert a new record into a named table.
- Parameters:
tableName
- must be the name of a table in the current schema- See Also:
Schema.getSchema()
,
Schema.getTable(java.lang.String)
NewRecord
public NewRecord(Table table)
- Insert a new record into Table.
setRethrow
public void setRethrow(boolean b)
- Set whether any
DuplicateKeyException
or InvalidValueException
will
be re-thrown by this NewRecord instance. By default, these exceptions will be handled
and converted into RequestError
objects. SQLExceptions are always caught and
handled.
getLastInsertID
public int getLastInsertID()
- Get the last rowID that was generated by a call to the
create(agonism.dovetail.site.Form)
method.
- Returns:
- the rowID, or -1 if there isn't one
- See Also:
Insert.getLastInsertID()
create
public boolean create(Form form)
- Create a new record from a Form. The form's
IRequestContext
will be used to report any
exceptions which occur while inserting the record, and to get an IParameterSource
which will supply the data for the new record. The form's Page
will be used to get
a database Connection.
- See Also:
IRequestContext.getParameterSource()
,
Page.getConnection()
create
public boolean create(java.sql.Connection c,
Form form,
agonism.dovetail.db.IParameterSource source)
- Create the new record. The form's
IRequestContext
will be used to report any
exceptions which occur while inserting the record.
- Parameters:
source
- should contain a value for all columns which are required by the table
specified in the constructor.- Returns:
- whether the creation of the new record was successful