About this task
The most common operation of Electronic Journal (EJ) is to add an
EJ record during traction. Add an EJ records you need to do the following
steps:
- Get a new instance of EJRecord using the method of getNewEJRecordInstance
- Set the required data into the EJRecord. The setRestoreDetailDataToRecord,
a member function of the EJUtils class, is to serialize the second parameter
and assign the result to the RestoreDetailData, which is one of record's fix
fields .
- Call addRecord method to add the record into the repository
Results
Tip: You don't have to destroy the EJ instance. Because
EJ instance is instantiated with the BTT Element Factory, the destroy function
is called by the container automatically.
Example
Here is an example of adding a record:
EJRecord record=ej.getNewEJRecordInstance();
record.setUserID("user02");
record.setDate("20080728");
record.setFieldData( "TxnID", "801");
record.setFieldData("BankID", "ICBC");
record.setFieldData("ACCOUNT", "43072884110832096");
record.setFieldData( "AMOUNT", "698.00");
record.setRestoreData(" XXUUII");
record.setFieldData("ACCOUNT2", null);
EJUtils.setRestoreDetailDataToRecord(record, new String("11111111111sssssssssss"));
int seqNum=ej.addRecord(newrecord);