The project uses a Java class, BookOperation.java, that needs to be imported into your project.
This code converts the instance data types from the Web service to types for the COBOL application and do the appropriate initialization for the COBOL application.
This opens the Import dialog box.
public static final String BOOK_FILE = "<tutorial_source_folder>\\DataFiles\\bookfile.dat";
The project builds automatically, but in this case the code compiles with errors. This is because some of the types used are in the COBOL projects.
In the outline view are the methods readBook(), nextBook(), deleteBook(), and addBook(), which receive the instance data from the Web service. Each in turn calls a doOperation() method which then converts the data into type of a similar structure for the COBOL application.
The conversion to COBOL is made easier by the types created by SMARTLINKAGE (Details and StatusGroup) enabling a transfer of fields between the Web service types and the ones for the COBOL application. These transfers are done in the methods getDetails() and getBookReturnE().
The final method of note is the overload of doOperation().
static private BookReturnE doOperation(String action, Details details, IRunUnit runUnit) { StatusGroup statusGroup = getObject(StatusGroup.class, runUnit); BookWrapper bookWrapper = getObject(BookWrapper.class, runUnit); bookWrapper.setfilename(BOOK_FILE); bookWrapper.BookWrapper(action, details, statusGroup); return getBookReturnE(details, statusGroup); }
The method invoke bookWrapper.BookWrapper(action, details, statusGroup); calls into the COBOL application and was added to the class by the SMARTLINKAGE feature.
The methods of this class can be static as they do not have any instance data and it reduces the number of objects that are created and garbage collected.
The next step is to update the four methods in the BookLegacySkeleton class to call the appropriate methods in the BookOperation class.