Sample EnvironmentImporter interface usage

Use the EnvironmentImporter interface to import compressed files that were exported from a source instance into a target instance of Product Master.

See IBM® Javadoc Documentation to view all of the available information on the parameters, returns, exceptions, and syntax for the EnvironmentImporter class.

This sample code shows the getImportList(Document document) method that is being used to retrieve the list of the objects from the document file /data/wpc in the document store, then uses the importEnvironment(Document document) method to import document into the file system of the company.

Context ctx = null;
EnvironmentImporter envImporter = null;
ImportList importList = null;
try
{
   ctx = PIMContextFactory.getContext("Admin","xxx","MyCompany");
   envImporter = ctx.getEnvironmentImporter();
   Document document = ctx.getDocstoreManager().getDocument("/data/wpc.zip");
   importList=envImporter.getImportList(document);
   envImporter.importEnvironment(document);
}
catch (PIMAuthorizationException ae)
{
   // Expected a failure
   System.out.println("Authorization Failure");
   return;
}
catch(PIMInternalException ie)
{
   System.out.println("Internal Error");
   return;
}
catch(Exception e)
{
   System.out.println(e.getMessage());
}