Understanding Development Activities

This section discusses development activities for using the Inbound File Loader utility and describes:

  • General development activities

  • Development activities for PeopleSoft Integration Broker processing.

  • Creating file layout definitions.

  • Development activities for application class processing.

This section discusses general development activities for using the Inbound File Loader utility using either PeopleSoft Integration Broker processing or application class processing.

Determining the Format for Inbound Data

Determine the necessary format of the inbound data. If there is an industry standard, use it for your file definition. If there is no industry standard, create a file layout object.

This section discusses development activities for using the PeopleSoft Integration Broker processing in conjunction with the Inbound File Loader utility.

  1. Create a message definition in the PeopleSoft Pure Internet Architecture.

    The structure of the message definition must be similar to the structure of the file layout definition that you created.

  2. Create a service.

  3. Create an asynchronous one-way service operation for the service.

  4. Create a local-to-local routing definition for the service operation.

  5. Create an OnNotification handler and call the functional library IB_FILE_SUBCODE.

    PeopleTools delivers this functional library and it can be used for any generic notification.

    The following example shows code an OnNotification handler calling the functional library:

    import PS_PT:Integration:INotificationHandler;
     
    class QUSubscribe implements PS_PT:Integration:INotificationHandler
       method QUSubscribe();
       method OnNotify(&_MSG As Message);
    end-class;
     
    Declare Function Subscribe PeopleCode FUNCLIB_IBFILE.IB_FILE_SUBCODE FieldFormula;
     
    /* constructor */
    method QUSubscribe
    end-method;
     
    method OnNotify
       /+ &_MSG as Message +/
       /+ Extends/implements PS_PT:Integration:INotificationHandler.OnNotify +/
       /* Variable Declaration */
       
       Local Message &MSG;
       Local Rowset &MSG_ROWSET;
       
       &MSG = &_MSG;
       
       Subscribe(&MSG);
       
    end-method;
    
  6. Define processing rules in the Inbound File Loader Rules page in the PeopleSoft Pure Internet Architecture.

  7. Initiate flat file processing using the Inbound File Processing page.

  8. Test the inbound flat file processing.

When you use the Inbound File Loader utility, you use file layout definitions to read and write data from flat files. Use the following guidelines when creating file layout definitions:

  • Create a file layout definition with the same structure as the message definition to support the vendor file format.

  • The hierarchical structure of the data in the file layout definition must match that of the message definition. For example, suppose a message has three levels:

    • Level 0, containing record A.

    • Level 1, containing records B and C.

    • Level 2, containing record D.

    All file layouts that are associated with this message must also have record A in level 0, record B and C in level 1, and record D in level 2.

    Note: The file layout does not need to contain the exact same fields as the message definition

  • For every record in a file layout definition, add a new file field, AUDIT_ACTN, as the first field in the record (except when the field already exists in the application table).

  • You can associate more than one file layout to a single message. For example, vendor A may have a different number of fields than vendor B, so you may have two file layouts: one for vendor A and one for vendor B.

  • Specify the file ID uniquely to include a row in a file, which is necessary in mapping the data to its proper record. Include start and end points when dealing with more than one record in a file layout.

  • Each record in the file layout has a file record ID attribute. Do not confuse this with the file layout ID. The file layout ID determines whether a new layout is encountered for multiple file layout processing.

This section discusses development activities for application class processing using the Inbound File Loader utility. This section discusses how to:

  1. Create an application class.

  2. 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.