These events occur when a workspace, in which the module is running, is added to or restored from a transport package. You can implement handling of these events to export or import the module's external resources, such as documents or records (note that module storage is transported automatically).
To register for the export and import events, you need to create a property com.sap.workspaces.module.metadata.extension~transport in the portalapp.xml , for example:
<property name="com.sap.workspaces.module.metadata.extension~transport" value="prt_service:com.yourname.portal.workspaces.modules.MyExtensionService"/>.
The following example illustrates how to add module-related entries to a workspace transport package during export.
public AbstractExportEntry[] getExportEntries(IModuleContext context) { // Create an array of export entries AbstractExportEntry[] exportEntries = new AbstractExportEntry[1]; // Create an entry to export; can be more than one AbstractExportEntry exportEntry = new MyExportEntryImpl(context); exportEntries[0] = exportEntry; return exportEntries; }
The following example illustrates how to retrieve module-related entries from a workspace transport package during import.
public void importEntries(IModuleContext context, AbstractImportEntry[] importEntries) throws IOException { // Iterate through the entries for(int i=0; i<importEntries.length; i++) { AbstractImportEntry importEntry = importEntries[i]; InputStream stream = importEntry.getInputStream(); // Do something with the stream } }