Command Line Import


The command-line import program is designed to allow you to execute any of the imports using a command-line interface. This program may be run either from the server running Unanet, of from a different computer that has standard TCP/IP access to the port (usually 80) on the Unanet server that is used to access Unanet. Basically, if you can access Unanet using a browser from a particular machine, then you can use the command-line import program from that machine.

The command-line import program is located in the unanet/tools/utilities directory, and is named Import.jar. To run the program, simply make the directory containing the Import.jar file your current directory and type:

   java -jar Import.jar

This will simply give you a help message, since it doesn't include all the required elements.


You must have Java 1.3 or higher to use the command-line import program.

Syntax And Options

Usage: java -jar Import.jar --help
java -jar Import.jar --url url --username username --password password --import type [--option var=value] [--file file]

--url url The base URL for the Unanet application. For example:
--username username A Unanet administrator login username.
--password password The password for the Unanet administrator.
--import type The type of import. Available types are:
  • approval_group
  • assignment
  • organization
  • person
  • planned_work
  • project
  • task
  • time
  • expense
  • mie_breakdown
  • per_diem_rates
--option var=value

An additional option that should be sent to the server when performing the import. May be used multiple times. Each option must include an equal sign. The left of the equal sign is the name of the option, the right side is the value. This will have no effect unless the Unanet import type understands the option.  For example:

--option update_passwords=true
--file file The file to import. This file must follow the appropriate format for the import type being performed. If no file option is used, then the program reads the standard input.

Currently, several Unanet import types support options:

Import Type Option Syntax Description
person  update_passwords --option update_passwords=true Valid values for this option are true and falsefalse is used by default if no value was provided.
time updateMethod
--option updateMethod=append --option status=locked Valid values for updateMethod are replace and appendappend is used by default if no value was provided.  Valid values for status are inuse, submitted, completed and lockedinuse is used by default if no value was provided.
expense method
--option method=person --option status=locked Valid values for method are people, project and itemperson is used by default if no value was provided.  Valid values for status are inuse, submitted, completed, locked and extractedinuse is used by default if no value was provided.

Running The Command Line Import from Another Machine

You must copy two files to the machine from which you will run the command-line import program, and these files must be located in the same directory:

Also, you must have Java 1.3 or higher installed on the machine. You can obtain Java from

Reading The Output

The command-line import utility produces exactly the same output as the standard, interactive Unanet import screens. It simply dumps the output to standard output. If you are using the command-line import utility in an unattended situation, you should capture this output and e-mail it to someone who can check the results. Or, for a more ambitious solution, you could parse it and take conditional actions based on the results.

A sample session (using a one line person import file) might look like this:

C:\unanet\tools\utilities> java -jar Import.jar --url --username admin --password admin --import person --file person.csv
Person Import starting...

'GBARRETT' was updated successfully.  Line1

Total People processed:		1
Total People added:		0
Total People updated:		1
Total People rejected:		0

The command-line import utility will return 0 if it runs successfully, and non-zero if it failed for a detectable reason. Failures will also output a reason for the failure on standard error output.

Using SSL

Java 1.3 does not natively support SSL/TLS, so it does not support the HTTPS protocol. Sun has made the JavaTM Secure Socket Extension (JSSE) available at

These instructions are intended to suppliment the instructions included with JSSE, not to replace them.

JSSE comes as a zip file for Java 1.2 and 1.3. JSSE support is already included in Java 1.4, but we have not tested that with our application since it is still in beta at this time. Once you unzip the file there is an INSTALL.txt file that details the installation procedure. These seem rather complex since there are many options. Here is what we did to make it work:

  1. Install the JSEE jar files. (INSTALL.txt - Step 3) Add the three jar files (jcert.jar, jnet.jar, and jsse.jar) in your CLASSPATH, or just add them to the lib/ext directory in your Java installation.

  2. Register the SunJSSE provider. (INSTALL.txt - Step 4a) Add this line to

  3. HTTPS Support. (INSTALL.txt - Step 6) Tell Java to use JSSE for the HTTPS protocol by defining a system property. The easiest way to do this is to simply add it to the command line. So now your import command line will look something like this (all on one line, of course):

    java -jar Import.jar --url --username jdoe --password password --import person --file people.csv

Copyright 1998-2002 Computer Strategies, Inc., All Rights Reserved.
Last revised: September 13, 2002 .