Business components : Business components : Branch application components : Electronic Journal and Electronic Journal Viewer : Tasks
  
Tasks
See also
Instantiating an EJ element
Using Counters
Configuring Electronic Journal Viewer GUI
Using Electronic Journal Viewer
Recurring the transaction
Electronic Journal and Electronic Journal Viewer
Instantiating an EJ element
Prerequisite: To instantiate an EJ element, there are three elements need to configure here: field mapping, JDBC DAO, and UDTT EJ. UDTT Element Factory uses the XML file to generate a UDTT EJ instance.
1 Use the following XML file sample for configuration:
<props id="classTable">
<entry key="EJDAO" value="com.ibm.btt.bc.ej.dao.jdbc.EJDAOJdbcImpl" />
<entry key="EJBase" value="EJBase" />
<entry key="EJBufferImpl" value="com.ibm.btt.bc.ej.BTTEJBufferImpl" />
<entry key="DAOConfig" value="com.ibm.btt.bc.ej.dao.jdbc.JdbcConnectionConfig" />
</props>
<java.util.ArrayList id="UserDefinedFieldsDescriptionTable">
<com.ibm.btt.bc.ej.FieldDescriptor fieldName="ACCOUNT" isNumeric="false" />
<com.ibm.btt.bc.ej.FieldDescriptor fieldName="AMOUNT" isNumeric="true" />
<com.ibm.btt.bc.ej.FieldDescriptor fieldName="TxnID" isNumeric="false" />
<com.ibm.btt.bc.ej.FieldDescriptor fieldName="BankID" isNumeric="false" />
<com.ibm.btt.bc.ej.FieldDescriptor fieldName="Status" isNumeric="false" />
<com.ibm.btt.bc.ej.FieldDescriptor fieldName="ACCOUNT2" isNumeric="false" />
<com.ibm.btt.bc.ej.FieldDescriptor fieldName="AMOUNT2" isNumeric="true" />
</java.util.ArrayList>
<com.ibm.btt.bc.common.pool.ConnectionPoolImpl id="JDBCDAOPool" disablePool="true">
<com.ibm.btt.bc.common.pool.JdbcConnectionConfig
Injection="jdbcConfig" dbDriverName="COM.ibm.db2.jdbc.app.DB2Driver"
dbUrl="jdbc:db2:journal" dataSource="jdbc/DEMO" />
<com.ibm.btt.bc.common.pool.PoolProperty Injection="poolProperty" maxActive="10" />
</com.ibm.btt.bc.common.pool.ConnectionPoolImpl>
<com.ibm.btt.bc.ej.BTTEJBase id="ejJdbcT1" sharedMode="false">
<com.ibm.btt.bc.ej.dao.jdbc.EJDAOJdbcImpl Injection="ejDAO" tableName="ejtable">
<ref Injection="connectionPool" refId="JDBCDAOPool" />
</com.ibm.btt.bc.ej.dao.jdbc.EJDAOJdbcImpl>
<ref Injection="userDefinedFieldsDesc" refId="UserDefinedFieldsDescriptionTable" />
</com.ibm.btt.bc.ej.BTTEJBase>
2 Use the following code sample to get a UDTT EJ instance. You get an EJ instance which is named ej, and you can use it during the transaction.
InitManager.reset("jar:///com/ibm/btt/bc/ej/ut/btt.xml");
BasicElementFactory ejFactory=new BasicElementFactory("jar:///com/ibm/btt/bc/ej/ut/ej.xml");
BTTEJ ej= ejFactory.getElement("ejJdbcT1");
See also
Tasks
Using Electronic Journal
Prerequisite: 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:
1 Get a new instance of EJRecord using the method of getNewEJRecordInstance
2 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.
3 Call addRecord method to add the record into the repository
Note You don't have to destroy the EJ instance. Because EJ instance is instantiated with the UDTT Element Factory, the destroy function is called by the container automatically.
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);
See also
Tasks
Configuring Electronic Journal Viewer GUI
The UNICOM® Digital Transformation Toolkit (UDTT™) Electronic Journal Viewer (EJV) provides a SWT Composite that contains the query GUI and result presentation GUI. Those two parts are encapsulated in the Composite, but you can configure them in the XML file. Perform the following procedure to configure the EJV GUI:
1 Add the class mappings into the XML configuration file. It binds the XML tag name with the implementing class. For example: QueryConditionFieldDescriptor corresponds to the com.ibm.btt.bc.ej.viewer.config.QueryConditionFieldDescriptor java class. Use the following codes:
<props id="classTable">
<entry key="QueryConditionLayout" value="com.ibm.btt.bc.ej.viewer.config.QueryConditionLayout" />
<entry key="QueryResultLayout" value="com.ibm.btt.bc.ej.viewer.config.QueryResultLayout" />
<entry key="QueryConditionFieldDescriptor"
value="com.ibm.btt.bc.ej.viewer.config.QueryConditionFieldDescriptor" />
<entry key="QueryResultFieldDescriptor" value="com.ibm.btt.bc.ej.viewer.config.QueryResultFieldDescriptor" />
<entry key="EJViewerConfigurationObject" value="com.ibm.btt.bc.ej.viewer.config.EJViewerConfigurationObject"/>
</props>
2 Configure the query fields in UDTT Element Factory XML configuration file. For example:
<QueryConditionLayout id="conditionUIlayout" colum="3" >
<java.util.ArrayList Injection="fieldsList">
<QueryConditionFieldDescriptor fieldName="TxnID" />
<QueryConditionFieldDescriptor fieldName="ACCOUNT" />
<QueryConditionFieldDescriptor fieldName="ACCOUNT2" />
<QueryConditionFieldDescriptor fieldName="Status" />
<QueryConditionFieldDescriptor fieldName="AMOUNT" />
<QueryConditionFieldDescriptor fieldName="BankID" />
</java.util.ArrayList>
</QueryConditionLayout>
The following query condition GUI is generated by the above configuration code. User ID, Sequence Number, and Date are added by the UDTT EJ automatically.
This graphic is described in the surrounding text.
3 Configure the result fields in UDTT Element Factory XML configuration file. For example:
<QueryResultLayout id="resultUIlayout" >
<java.util.ArrayList Injection="fieldsList">
<QueryResultFieldDescriptor fieldName="TxnID" width="100"/>
<QueryResultFieldDescriptor fieldName="ACCOUNT" width="200"/>
<QueryResultFieldDescriptor fieldName="AMOUNT" width="100"/>
<QueryResultFieldDescriptor fieldName="Status" width="100" />
<QueryResultFieldDescriptor fieldName="ACCOUNT2" width="200"/>
<QueryResultFieldDescriptor fieldName="BankID" />
</java.util.ArrayList>
</QueryResultLayout>
The configuration code above will generate the following query result GUI. User ID, Date and Sequence Number are added by the UDTT EJ automatically.
This graphic is described in the surrounding text.
4 Configure the UDTT EJV with the items you have defined.
<EJViewerConfigurationObject id="ejvconfig">
<ref Injection="queryConditionLayout" refId="conditionUIlayout" />
<ref Injection="queryResultLayout" refId="resultUIlayout" />
<ref Injection="ejInstance" refId="ejJdbcT2" />
</EJViewerConfigurationObject>
The conditionUIlayout and resultUIlayout are defined in step 2 and step 3. The ejJdbcT2 is defined in the section concerning EJ.
See also
Tasks
Using Electronic Journal Viewer
The UNICOM® Digital Transformation Toolkit (UDTT™) Electronic Journal Viewer (EJV) provides an EJViewerComposite wrapped org.eclipse.swt.widgets.Composite, containing the query GUI and result presentation GUI. To use the UDTT EJV, add the EJV Composite to the UDTT RCP framework. Perform the following steps to use the EJV:
1 Add an EJV activity. Open the UDTT RCP framework, extend com.ibm.btt.rcp.activity.activities, and add activity EJViewer. The following figure displays the Extension Element Details panel:The com.ibm.btt.bc.common.activity.BCActivity class is in the com.ibm.btt.bc.common plugin, and shared as activity class for nearly all UDTT Business Components. The parameter of the EJ Viewer activity is a string integrated by two parts. The first part is com.ibm.btt.bc.ej.viewer.impl.EJViewerCompositeFactory which is provided by UDTT EJV, and the second is ejvconfig which is the ID of EJViewerConfigurationObject you have configured in the XML file.
This graphic is described in the surrounding text.
2 Add the navigation item for EJV. Extend com.ibm.btt.rcp.navigator.items, and add an item. The following figure displays the Extension Element Details panel:
This graphic is described in the surrounding text.
The activityId is the ID of the EJ Viewer activity.
3 Add a few code. In the start method of Activitor, the following code should be added to initialize the UDTT Element Factory for Busniess Component:
InitManager.reset("jar:///btt/btt.xml");
BasicElementFactory ejFactory = new BasicElementFactory("jar:///com/ibm/btt/bc/ej/viewer/ut/ej.xml");
BTTFactory.setElementFactory(ejFactory);
After Completing This Task: Now the EJV can be used in the RCP application. Input the query conditions, click the query button, and then the result is displayed in the table.
This graphic is described in the surrounding text.
See also
Tasks
Recurring the transaction
Prerequisite: The UDTT EJV provides the EJRestroeTransactionXUIImp java class, which provides the EJRestoreTransactionListener interface for the recurrence. And the EJRestoreTransactionListener interface provides the restore method to implement recurrence.
public void restore(EJRecord record,Composite displayParent) throws Exception;
During the transaction, when you add an EJRecord, if you want the record to be recurred, store the transaction data in the RestoreData field and the XUI information in the RestoreDetailData field. The restore method will use the information to complete the recurrence.
For example, add EJRestroeTransactionXUIImp for recurrence in the UDTT Element Factory XML configuration file.
<EJViewerConfigurationObject id="ejvconfig">
<ref Injection="queryConditionLayout" refId="conditionUIlayout" />
<ref Injection="queryResultLayout" refId="resultUIlayout" />
<ref Injection="ejInstance" refId="ejJdbcT2" />
<com.ibm.btt.bc.ej.viewer.impl.EJRestoreTransactionXUIImpl Injection="restoreHandler"
initPath="jar:///com/ibm/btt/bc/ej/viewer/ut/xuiengine.xml" />
</EJViewerConfigurationObject>
The conditionUIlayout, resultUIlayout, and ejJdbcT2 are the ones that define in Configuring Electronic Journal Viewer GUI and the restoreHandler is for recurrence.
After Completing This Task: After the query results are retrieved and presented in the table, you can double-click one row to trigger the recurrence of the corresponding transaction.
This graphic is described in the surrounding text.
See also
Tasks