Sample ExportList interface usage
Use the ExportList interface to create an export list container object that lists all the object names and types to be exported and the action mode that each object uses during import.
See IBM® Javadoc Documentation to view all of the available information on the parameters, returns, exceptions, and syntax for the ExportList class.
This sample code shows two addAllObjects(ExportList.Type type, ExportList.ActionMode actionMode) methods. One method is used to add the objects of type ExportList.Type.CATALOG to the export list container object with their action modes specified as ExportList.ActionMode.CREATE_OR_UPDATE. The second method is used to add the objects of type ExportList.Type.SPEC to the export list container object with their action modes specified as ExportList.ActionMode.CREATE_OR_UPDATE.
Context ctx = null;
EnvironmentExporter envExporter = null;
ExportList exportList = null;
try
{
ctx = PIMContextFactory.getContext("Admin","xxx","MyCompany");
envExporter = ctx.getEnvironmentExporter();
exportList=envExporter.createExportList();
try{
exportList.addAllObjects(ExportList.Type.CATALOG, ExportList.ActionMode.CREATE_OR_UPDATE);
exportList.addAllObjects(ExportList.Type.SPEC, ExportList.ActionMode.CREATE_OR_UPDATE);
}
catch(IllegalArgumentException exc)
{
System.out.println(exc.getMessage());
}
exportList.addAllRequisites();
envExporter.export(exportList, "/envexport/wpc.zip");
}
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());
}