Export tool

The export tool allows you to export data from a equanda 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 :


[general]
scanPeriod=30

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

window=display

server=192.168.0.252
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
  • server : name or ip address of server
  • login : login to connect to the equanda application
  • password : password to connect to the equanda 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


[object,1]

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

selectorName=ImportStatus
selectorParamType1=String
selectorParamValue1=Y

setField1=ERPImportStatus
setFieldType1=String
setFieldValue1=D

script=WeightGroup.esc

[object,1,1]

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

selectorName=WeightGroup
selectorParamType1=String
selectorParamValue1=${Reference}

script=WeightGroup.esc

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 selector 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")
  • selectorName : the name of the selector to be used
  • selectorParamTypeX : type of the selector's Xth parameter, can be String, int, double, boolean, Timestamp, Date
  • selectorParamValueX : value of the selector's Xth parameter
  • setFieldX : name of the field to be set (after the object is exported)
  • setFieldTypeX : type of the field to be set, same choices as selectorParamType
  • setFieldValue1X : 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 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
endfunc

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.

  • 1. Export tool
  • 1.1. General configuration
  • 1.2. What to export
  • 1.3. Using scripts in export