How to export only specified process template to the sandbox(Local system) using RTC API
Accepted answer
Look at com.ibm.team.process.internal.ide.ui.wizards.ExportProcessDefinitionWizard.exportToArchive(IProcessDefinition, File, IProgressMonitor). You can find the class in the Eclipse client using Plugin Spy (SHIFT+ALT+F1) on the export wizard that you can open from looking at the process template administration. This shows the code if you have setup RTC with the SDK.
It is however internal API:
It is however internal API:
/** * Exports the given process definition to the given archive file. * * @param definition the definition to export * @param archive the archive file to export into. */ private void exportToArchive(IProcessDefinition definition, File archive, IProgressMonitor monitor) throws TeamRepositoryException { monitor.beginTask("", 1000); //$NON-NLS-1$ // get exported file from server IProcessInternalClientService processService = (IProcessInternalClientService) fWizardContext.fTeamRepository.getClientLibrary(IProcessInternalClientService.class); IContent content = processService.createProcessDefinitionExportZip(definition.getItemId().getUuidValue(), new SubProgressMonitor(monitor, 200)); // write content to file try { FileOutputStream stream = new FileOutputStream(archive); fWizardContext.fTeamRepository.contentManager().retrieveContent(content, stream, new SubProgressMonitor(monitor, 800)); } catch (FileNotFoundException e) { throw new TeamRepositoryException(e); } }