return retVal;
}
public TaskID insertTask( Task task ) {
TaskID retVal = null;
Connection connection = null;
try {
String sql = "insert into bpm_task ( id, userid, groupid, description," +
" expiration, tokenid, status, instanceid )" +
" values ( ?, ?, ?, ?, ?, ?, ?, ? )";
int taskID = generateKey();
connection = getConnection();
connection.setAutoCommit(false);
PreparedStatement statement = connection.prepareStatement( sql );
statement.setInt( 1, taskID );
UserID userID = task.getUserID();
if (userID == null) {
statement.setNull( 2, Types.INTEGER);
}
else {
statement.setInt( 2, userID.getID() );
}
GroupID groupID = task.getGroupID();
if (groupID == null) {
statement.setNull( 3, Types.INTEGER);
}
else {
statement.setInt( 3, groupID.getID() );
}
statement.setString( 4, task.getTaskDescription() );
statement.setDate( 5, new java.sql.Date(
task.getTaskExpirationDate().getTime() ) );
statement.setInt( 6, task.getSourceTokenID().getID() );
statement.setInt( 7, task.getTaskStatus() );
statement.setInt( 8, task.getInstanceID().getID() );
statement.execute();
connection.commit();
statement.close();
retVal = new TaskID( taskID );
} catch( SQLException e ) {
throw new RuntimeException( e );
}
finally {
if (connection != null) {