Appendix > Installing the Remote API > To work with documents
To work with documents
When you have a handle to a roundtrip, you can see a list of import/export documents within, or add new ones. Adding new documents to a roundtrip configuration can be done by selecting a new module from Windchill RV&S (the requirement management tool), or by selecting a requirement exchange file (RIF, ReqIF, etc.). The requirement exchange file can be a simple XML file, or an archive containing multiple files. See the example below:
// To add import documents from a server path
// You can add multiple files, supported are Rif files (.xml), Rif zip files (.zip),
// ReqIf files (.reqif), ReqIF zip files (.reqifz)

IOperationResult result = remoteClient.addImportDocumentsFromServerPath(configuration,
new String[] { "C:/foo/bar/reqIfFile.reqif"}, true);
// check the result
// You will find the new / changed import documents with the getImportDocuments method
configuration.getImportDocuments()

// To add import documents from workspace
IRemoteFile reqifDocument ...;
IOperationResult result = remoteClient.addImportDocumentsFromWorkspace(configuration,
new IRemoteFile[] { reqifDocument }, true);

// To set the target path of newly added import documents
IRemoteImportDocument document = ...;
// you can browse in the tool import folder to find the target folder
// you must be connected to the tool
IRemoteToolFolder toolFolder = remoteClient.getImportFolder(configuration);
...
IRemoteToolFolder targetFolder = ...;
document.setTargetPath(targetFolder.getPath());

// To add export documents you can browse in the export folders of the tool
to find the document
IRemoteToolFolder toolFolder = remoteClient.getExportFolder(configuration);
// isDocument method will return true
IRemoteToolItem documentToExport = ..;
IOperationResult result = remoteClient.addExportDocuments(configuration,
new String[] { documentToExport.getID() });
// if the result is successful you will find the export document by ID
for(IRemoteExportDocument document : configuration.getExportDocuments()) {
if(document.getDocumentID().equals(documentToExport.getID()) {
// export document found
}
}
Was this helpful?