coding style
to do

Export tool

The export tool allows you to export data from a Uni-d generated application to text (ascii). Alternatively, the data which is exported can be processed using a script which then handles it further. This option is typically used to synchronize with another application (one-way synchronization, use the Import tool for the other direction).

General configuration

The export program expects the name of the configuration .ini file as parameter. If this parameter is not given, a file called "export.ini" in the current directory is used.

The export can be configured using a .ini file with the following base format :


exportDirectory=c:export exportInfo=exportInfo=org.ictrace.demo.maps.ExportMap exportIni=exportConfig.ini


server= login=myname password=mypass

  • scanPeriod : time in seconds between attempts to pick up files to import, default 120
  • exportDirectory : directory where the export files need to be written
  • window : indicates whether a window needs to be displayed or not (values "display" or "hidden")
  • exportInfo : full class name of the ExportInfo map needed for export
  • exportIni : defines the ExportFileFormat which should be used
  • server : name or ip address of server
  • login : login to connect to the Uni-d application
  • password : password to connect to the Uni-d application

What to export

The .ini file also defines what to export. This is done by specifying the objects which need to be selected. For each object selected, you can have selections of secondary (related) objects which are also exported. After the export, the tool can automatically update one of the fields to mark that the export was succesful.

For example


selectorJndi=IC-trace/WeightGroupSelector selectorName=org.ictrace.client.WeightGroupSelector

finderName=ImportStatus finderParamType1=String finderParamValue1=Y

setField1=ERPImportStatus setFieldType1=String setFieldValue1=D



selectorJndi=IC-trace/WeightGroupTotalSelector selectorName=org.ictrace.client.WeightGroupTotalSelector

finderName=WeightGroup finderParamType1=String finderParamValue1=${Reference}


This excerpt shows all the options. The first (and only) primary selector is indicated in the object,1 section. The secondary selections for these are in the object,1,X sections, with "X" a number from one upwards.

For each section, you can specify the JNDI name and classname for the bean to use. The classname should be without trailing "EJB" or "EJBHome". You can also specify the finder to be used, and the type and value for each paramater. For secondary objects, fields from the primary object can be used to as parameter value using the "${FieldName}" syntax.

For each object, you can also optionally spacify fields which need to be set when the import was successful. You can also choose whether the export is to a file, or whether a user defined FScript script should handle the export (in which case the file is not generated).

_Key Set Details_

  • selectorJndi : JNDI name whether the object which is selected can be found, normally a prefix followed by the table name.
  • selectorName : full name of the selector class (without trailing "EJB")
  • finderName : the name of the finder to be used
  • finderParamType~~X~~ : type of the finder's ~~X~~th parameter, can be ~~String~~, ~~int~~, ~~double~~, ~~boolean~~, ~~Timestamp~~, ~~Date~~
  • finderParamValue~~X~~ : value of the finder's ~~X~~th parameter
  • setField~~X~~ : name of the field to be set (after the object is exported)
  • setFieldType~~X~~ : type of the field to be set, same choices as finderParamType
  • setFieldValue1~~X~~ : value for the field to be set
  • script : name of the script which is used to export the object
_NOTE:_ All keys are _case sensitive_ !!!

Using scripts in export

Like in Import you can also use scripts to export the data, possibly including the data directly into a different database.

The program accepts FScript (see scripts to build the data to be exported. The script should have the following structure (example with some debug info) :

func primary(object prim)
    debug("primary called for "+prim)
    return TRUE

func primary_done(object prim) debug("primary_done called for "+prim) display("importing "+prim) return TRUE endfunc

func secondary(object prim, object sec) debug("secondary called for "+prim+":"+sec) return FALSE endfunc

The FScript extensions from the util module are available.

The functions should return "TRUE" or "FALSE" depending on whether the export was successful or not. If the export was not successful, then the variables which need to be set are not modified.

When you return "FALSE" for the primary object, then the secondary objects are not exported. When one of the secondary objects returned "FALSE", then the fields for the primary object are not set.

If the primary and all the secondary objects have been successfully imported, then the "primary_done" function is called. This can be used for cleanup, or to mark that the export has finished.

$Id: 1849 2006-01-12 13:48:28Z triathlon98 $