STEP and PLM Export Import
Export
Export of wtCollection is supported by the import export framework. Use the following API to export a wtCollectionto a jar:
IXBExpImpStatus status = IXBSvrHelper.service.doExport(parameters,true/*Server Export*/);
Where,
parameters refers to
ObjectExportParameters.
Boolean flag indicates that the execution happens inside method server stub.
IXBExpImpStatus object carries the result of the export operation.
Following are the key export parameters and APIs which are required to perform the export.
Parameter
Description
setClientFileName
The absolute file path where output jar is created. Client filename must not exist. It is a place holder where client is expecting the output jars to be stored. If the file path is not provided, then the information is exported to a random temporary location. PTC recommends that you set this parameter for export.
setCollection
wtCollection containing persistable objects to export. Persistable objects for which Import/Export handler exists and is supported for export. List of objects that are supported OOTB can vary based on the format type used. Refer to the related standards documentation for details.
setFormatType
ExportImportFormatType enumeration is used to define the format for the export. Supported format types are:
PLM_FORMAT – to export in the PLMS message format
STEP_FORMAT – to export in the STEP format
WNC_FORMAT – to export in the Windchill format. Windchill format refers to XMLs based on the standard DTD definitions provided by the object owners. This is the default format type.
setIxFormatType
IXFormatTypeis used to define information such as protocol, implementation method, format type and version. This is used for STEP format-based export.
IXFormatType object must always be created using the following method:
IXFormatTypeHelper.getIXFormatType
Set the following information:
setProtocol - IXFormatProtocolType – the protocol in which export is performed.
setImplementationMethod – IXFormatImplementationMethodType – the implementation method for export like XML, Part 21, Part 28.
Sample code to perform export of wtCollection
Following is a sample code to export wtCollection objects in STEP format with AP214 protocol and Part 21 implementation method:
ObjectExportParameters exportParameters = new ObjectExportParameters();
exportParameters.setCollection(wtCollection);
IXFormatType formatType = IXFormatTypeHelper.getIXFormatType(null, ExportImportFormatType.STEP_FORMAT);
formatType.setProtocol(IXFormatProtocolType.AP214);
formatType.setImplementationMethod(IXFormatImplementationMethodType.PART_21)
exportParameters.setIXFormatType(formatType);
String clientFile = “D:\temp\step.jar” – Absolute file path
exportParameters.setClientFileName(clientFile);
IXBExpImpStatus status = IXBSvrHelper.service.doExport(exportParameters, true);
Vector messages = status.getMessages();
System.out.println("Export messages:");
for (Object object : messages) {
System.out.println(object);
}
int count = status.getObjectCount();
System.out.println("No. of objects exported "+count);
boolean outcome = status.getOutcome();
System.out.println("Outcome of the export "+outcome);
String failureMessage = status.getFailureMessage();
System.out.println("Failure message "+failureMessage);
IXBExpImpStatus object contains response of the export or import operation. Use the following API of the object to fetch information:
Parameter
Description
getMessages
Vector of messages which provides status messages of export. This is similar to messages which are polled during UI export operation.
getObjectCount
Number of objects that were exported or imported.
getOutcome
Outcome of the operation whether it is success or failure. The value is True for success and False for failure.
getFailureMessage
Failure information like exceptions during export or import.
Import
Importing a jar to a given container is achieved through the following server-side API:
IXBExpImpStatus expImpStatus
= IXBSvrHelper.service.doImport(objectimportparameters,true);
Here objectImportParameters refers to ObjectImportParameter object, which carries all required information to perform import.
Following are the key import parameters and APIs which are required to perform import:
Parameter
Description
setContainer
Container, where import is performed.
setDataFile
IXBStreamer represents the file to be imported.
setIxFormatType
IXFormatType. For more details, refer to the section “Export” in this topic. This must be used for STEP based import. It must be same as the parameter used while performing the export of the file.
setRepository
IxbSTEPRepository object is the input for STEP file import. It encapsulates information such as, file and format type required for import.
Sample Code To Perform STEP Format Import
Following is a sample code to perform import using ObjectImportParameters of STEP format file exported in AP214 protocol with Part 21 implementation method:
ObjectImportParameters objectimportparameters = new
ObjectImportParameters();
IxbSTEPRepository repository = new IxbSTEPRepository(file);//file to import
objectimportparameters.setContainer(wtCoontainerRef);
IXFormatType formatType = IXFormatTypeHelper.getIXFormatType(null, ExportImportFormatType.STEP_FORMAT);
formatType.setProtocol(IXFormatProtocolType.AP214);
formatType.setImplementationMethod(IXFormatImplementationMethodType.PART_21)

ImportContextData importcontextdata = (ImportContextData)
objectimportparameters.getContextData();
importcontextdata.setEnableTuning(false);//Tuning is not supported for STEP formats.
repository.setIXFormatType(formatType);
objectimportparameters.setRepository(repository);
Sample Code To Perform PLM Format Export and Import
Following is a sample code for PLM format export. It is same as STEP format with the following exception:
exportParameters.setFormatType(ExportImportFormatType.PLM_FORMAT);
Following is the sample code for PLM format import. It is same as the STEP format with the following exception:
* 
Consider the file through streamer object instead of repository.
IXBSvrStreamer ixbstreamer = new IXBSvrStreamer(file);
ixbstreamer.setAttrib(IXBStreamer.SAVED_AS_FILE, file);
objectimportparameters.setDataFile(ixbstreamer);
Supported APIs details
Class
API
Purpose
ObjectExportParameters
ObjectImportParameters
setDetailedLog
To extract detailed information of export/import operation. This information is captured in memory in status object. In case of large data export or import it is recommended not to use this.
ObjectExportParameters
ObjectImportParameters
setValidation
To avoid DTD validation during export/import. This is required during development use case. In production setup, do not deploy this API with false.
ObjectImportParameters
setDataFile
Streamer file to use for importing WNC_FORMAT or PLM_FORMAT files. IXBSvrStreamer object is used to encapsulate the file information for import.
ObjectImportParameters
setUseExtendedMapping
To support extended mapping for AP242 protocol mapping of metadata. For more details, refer to Configuring Metadata Mapping.
War dies hilfreich?