Implementing User-Defined Output Control

To implement user-defined output control within a user-defined Datapump application, you must define a class that implements the JadeRpsDataPumpIF interface and its updateCallback method, as shown in the following example.

rpsDp_UpdateCallback(tranID: Integer64; timestamp: TimeStamp; oid: Object;
                     operation: Integer; tableName: String;
                     dropRowOperation: Boolean io;
                     outputRowInfo: JadeDynamicObject io) updating;
vars
    count        : Integer;
    indx         : Integer;
    int          : Integer;
    jdoPropName  : String;
    jdoPropValue : String;
begin
    // only Company is set as OutputControl in the RPS mapping,
    // so only rows for the table Company will be passed to this routine
    count := outputRowInfo.propertyCount();
    // log information about updates to this table
    writeToMyLog("update callback=" & tranID.String & "; operation=" &
                 operation.String & ";timestamp=" & timestamp.String &
                 ";oid=" & oid.String & ";tableName=" & tableName);
    writeToMyLog('---' & outputRowInfo.getName & ' ' &
                 outputRowInfo.getOidString & " " & count.String & ' ---');
    if operation = JadeRpsDataPumpIF.ObjectDeleted then
        return;
    endif;
    // log information about each column in row
    foreach indx in 1 to count do
        jdoPropName := outputRowInfo.getPropertyName(indx);
        jdoPropValue := outputRowInfo.getPropertyValueByIndex(indx).String;
        log.info(jdoPropName & " = " & jdoPropValue & ".");
      // look for column for "phone" and update value
      if jdoPropName = "phone" then
          if jdoPropValue.String = "(64) 3 555 4519" then
             outputRowInfo.setPropertyValueByIndex(indx, "(64) 3 999 4519");
             writeToMyLog("   phone changed to (64) 3 999 4519");
          endif;
      endif;
   endforeach;
   // if required, set dropRowOperation parameter to true to not output the
   // row operation to the relational database
end;

The updateCallback method enables you to inspect, modify columns, or drop rows as the rows are being output to the relational database table.

For create and update operations, the attribute values are populated with the values obtained from the JADE object, including values returned by user-defined column-mapping methods.

The application callback can interrogate attributes and change attribute values within the JadeDynamicObject.

Your data pump application must first call the Application class rpsDataPumpInitialize method, whose receiver parameter is an instance of your class that implements the JadeRpsDataPumpIF interface.

When database tracking commences, your user-defined Datapump application is driven by callbacks invoked in a defined transaction replication cycle.

Not all tables are likely to require output manipulation. To avoid the overhead of creating the dynamic objects and calling the user routine when not required, the Relational Population Service wizard enables you to select the tables for which the callback will be used.

By default, tables are not included in callbacks. (For details, see "Maintaining RPS Column Mappings", in Chapter 15 of the JADE Development Environment User’s Guide.)

Selecting output callback for a table has no effect if callbacks are not registered in your Datapump application or if you have not defined your own Datapump application.