370 IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines
See Figure 8-106.
Figure 8-106 Create the DummyJournal class
To implement the DummyJournal class, perform the following steps:
1. Add the import statements shown in Example 8-21.
Example 8-21 Additional import statements for DummyJournal.java
import javax.swing.JOptionPane;
import com.ibm.btt.base.Settings;
import com.ibm.btt.base.DSEObjectNotFoundException;
import com.ibm.btt.base.Tag;
import com.ibm.btt.base.TagAttribute;
2. Implement the addRecord(Context arg0, String arg1) method as shown in
Example 8-22.
Running H/F 1 371
Example 8-22 Implemented addRecord(Context arg0, String arg1) method for
DummyJournal.java
public int addRecord(Context arg0, String arg1)
throws DSEInvalidArgumentException, DSEInvalidRequestException,
DSEInternalErrorException, DSESQLException {
FormatElement formatter = null;
Hashtable dataHashtable = null;
String show = null;
try {
show=(String) Settings.getSettings().getValueAt("showMessagesOnServer");
} catch (DSEObjectNotFoundException e){
show = "false";
}
try {
formatter = new FormatElement();
formatter.setName(arg1);
dataHashtable = formatter.formatHashtable(arg0);
} catch(Exception e) {
if (show.equals("true")) {
JOptionPane.showMessageDialog(null,
e.toString(),
"Exception",
JOptionPane.ERROR_MESSAGE);
}
}
if (dataHashtable != null) {
if (show.equals("true")) {
String message = "The 'addRecord' method is now executed\n" +
"The following data is added to the journal:\n\n" +
dataHashtable.toString()+"\n\n";
JOptionPane.showMessageDialog(null,
message,
"Dummy journal service",
JOptionPane.INFORMATION_MESSAGE);
}
}
return 0;
}
3. Implement the updateRecord(int arg0, Context arg1, String arg2) as shown in
Example 8-23.
Example 8-23 Implemented updateRecord(int arg0, Context arg1, String arg2) method
for DummyJournal.java
public int updateRecord(int arg0, Context arg1, String arg2)
throws
DSEInvalidRequestException, DSEInvalidArgumentException,
DSEInternalErrorException, DSESQLException {
372 IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines
FormatElement formatter = null;
Hashtable dataHashtable = null;
String show = null;
try {
show=(String) Settings.getSettings().getValueAt("showMessagesOnServer");
} catch (DSEObjectNotFoundException e) {
show="false";
}
try {
formatter = new FormatElement();
formatter.setName(arg2);
dataHashtable = formatter.formatHashtable(arg1);
} catch(Exception e) {
if (show.equals("true")) {
JOptionPane.showMessageDialog(null,
e.toString(),
"Exception",
JOptionPane.ERROR_MESSAGE);
}
}
if (dataHashtable != null) {
if (show.equals("true")) {
String message = "to be updated with host reply data.\n" +
"The following data added to the journal:\n\n" +
dataHashtable.toString()+"\n\n";
JOptionPane.showMessageDialog(null,
message,
"Dummy journal service",
JOptionPane.INFORMATION_MESSAGE);
}
}
return 0;
}
4. Save and close the Java Editor.
To create the DummyJournalImpl class, do the following:
1. Right-click the btt.bank.services package, select New Class to create a
Java class.
2. Input the following properties to create the class:
–Name: DummyJournalImpl
Superclass: com.ibm.btt.services.jdbcjournalservice.JournalImpl
3. Click Finish.
Running H/F 1 373
Adding DummyJournal to BTTBank EAR project
To add the DummyJourna to BTTBank project, follow these steps:
1. Switch to the J2EE perspective, and expand the BTTBank project.
2. Double-click EAR Deployment Descriptor.
3. Click the Module tab.
4. Click Add in the Project Utility Jars section, as shown in Figure 8-107.
Figure 8-107 Click Add to add project utility JARs
Note: Since it is a dummy journal service, do not put any code in
DummyJournalImpl class.
374 IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines
5. In the pop-up Add Utility JAR dialog, select DummyJournal, and then click
Finish, as shown in Figure 8-108.
Figure 8-108 Select the DummyJournal project
6. Click OK when the Repair Server Configuration dialog pops up.
7. Press Ctrl+S to save the change.
Adding DummyJournal to bttsvcinfraEJB EJB project
To add the DummyJournal to the bttvcinfraEJB project, follow these steps:
1. In the J2EE perspective, right-click the EJB module bttsvcinfraEJB. Select
Properties from the context menu.

Get IBM Branch Transformation Toolkit 5.1 Migration and Usage Guidelines now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.