Development Activities for Application Class Processing
This section discusses development activities for application class processing using the Inbound File Loader utility. This section discusses how to:
-
Create an application class.
-
Specify processing rules.
Creating Application Classes
This section discusses creating an application class for processing flat files in conjunction with the Inbound File Loader utility.
The application class you create must implement the IProcessFile interface. The signature of the interface is shown here:
interface IProcessFile
/* Any initialization is done in this function*/
method Init (&fldDefName As string, &msgName As string) Returns boolean;
/* Contains processing logic that stores the Rowset data into the respective⇒
tables */
method Process(&fldDefName As string, &msgName As string, &rs As Rowset) Returns⇒
boolean;
/* This method shall contain logic for cleanup operations */
method Finish(&fldDefName As string, &msgName As string) Returns boolean;
end-interface;
The application class you create must implement the following three methods:
-
Init
-
Process
-
Finish
If the Replace Data check box is selected in the Inbound File Loader Rule page, the Init method will be called. The Finish method is the last method to be invoked by the utility. Any post-processing clean up code can be implemented with this function.
The logic in the Process method stores the file contents in staging tables. You can add logic in the Finish method to move the data from staging tables to the actual transaction tables as a final process.
The Init, Process and Finish methods must return a boolean value of True for successful completion of the file processing. If methods Init and Finish are not used, return a default value of True.
The following example shows an application class implementing the IProcessFile interface:
import PTIB:Interfaces:IProcessFile;
class InboundFileProcess implements PTIB:Interfaces:IProcessFile
method Init(&fldDefName As string, &msgName As string) Returns boolean;
method Process(&fldDefName As string, &msgName As string, &rs As Rowset) Returns⇒
boolean;
method Finish(&fldDefName As string, &msgName As string) Returns boolean;
end-class;
method Init
/+ &fldDefName as String, +/
/+ &msgName as String +/
/+ Returns Boolean +/
/+ Extends/implements PTIB:Interfaces:IProcessFile.Init +/
//This function will be called when the Replace Data flag is
//enabled
//add initialization code, such as cleaning up the table before
//reading in the data from the file
Return True;
end-method;
method Process
/+ &fldDefName as String, +/
/+ &msgName as String, +/
/+ &rs as Rowset +/
/+ Returns Boolean +/
/+ Extends/implements PTIB:Interfaces:IProcessFile.Process +/
//Add the code that inserts/updates/delete data in the table
Return True;
end-method;
method Finish
/+ &fldDefName as String, +/
/+ &msgName as String +/
/+ Returns Boolean +/
/+ Extends/implements PTIB:Interfaces:IProcessFile.Finish +/
//This function will be called when the Replace Data flag is
//enabled
// Clean up logic goes here (if any)
Return True;
end-method;
Specifying Processing Rules
After you create an application class, you must access the Inbound File Loader Rules page and specify the following information:
-
Root Package ID.
-
Path.
-
Class name.