The following APIs are provided by the BTT Electronic Journal:
BTTEJ is a common interface for all the EJ implementation. It contains the following APIs:
public int addRecord(EJRecord record) throws BTTEJException
This method is used to add a record, and a record sequence number will be returned.
public EJRecord[] queryRecord(EJQueryConditions queryConditions)throws BTTEJException
This method is used to query the EJ records. It uses the EJQueryConditions to construct a SQL sentence. The function returns the array of retrievied EJRecords
public EJRecord getEJRecordRestoreDetailData(EJRecord record) throws BTTEJException
This method is used to retrieve the RestoreDetailData information of an EJRecord.
public EJRecord getNewEJRecordInstance()
This method is used to get a new EJRecord instance. It serves as a factory method.
One instance of EJRecord corresponds to one transaction record. Before you insert a record to the database, each variable of the record should be initiated. You can set and get the information through the following methods. The name of the methods explains their function clearly.
public Object getFieldData (FieldDescriptor fd); public void setFieldData (FieldDescriptor fd, Object value); public Object getFieldData (String fieldName) throws BTTEJFieldNameNotDefinedException public void setFieldData (String fieldName, Object value) throws BTTEJFieldNameNotDefinedException
BTT provides the class BTTEJBase to implement the EJ interface. BTTEJBase is in charge of controlling record sequence number, validating the record value, access control and DAO access. And another class BTTEJBufferImpl, which extends from the BTTEJBase, provides a buffered EJ implementation as the following picture shows. .
The validator in BTT EJ is also provided as interface, you should implement them as needed, because the table structure is not fixed. There are also two method declarations in the interface EJRecordValidator. .
The method is used to validate the record before adding or updating the corresponding record into the database.
The method is used to validate queryCondtions before using its information in a SQL sentence.