Initiating New Export/Import Processes

In this tutorial, you’ll learn about the ExportImportConfiguration framework and how you can take advantage of provided services and factories to create these controller objects. Once they’re created, you can easily implement whatever import/export functionality you need.

Your first step is to create an ExportImportConfiguration object and use it to initiate your custom export/import or staging process.

  1. Use the ExportImportConfigurationSettingsMapFactory class to create a layout export settings map:

    Map<String, Serializable> exportLayoutSettingsMap =
        ExportImportConfigurationSettingsMapFactory.
            buildExportLayoutSettingsMap(...);
    
  2. Create the ExportImportConfiguration object by using an add method in the entity’s local service. The map created previously is used as a parameter to create the ExportImportConfiguration object.

    ExportImportConfiguration exportImportConfiguration =
        exportImportConfigurationLocalService.
            addDraftExportImportConfiguration(
                user.getUserId(),
                ExportImportConfigurationConstants.TYPE_EXPORT_LAYOUT,
                exportLayoutSettingsMap);
    

    The ExportImportConfigurationLocalService provides several useful methods to create and modify your custom ExportImportConfiguration.

  3. Call the appropriate service using your newly created ExportImportConfiguration object to initiate an export/import or staging process. For example,

    files[0] = exportImportLocalService.exportLayoutsAsFile(
        exportImportConfiguration);
    

    Notice that your ExportImportConfiguration object is the only needed parameter in the method. Your configuration object holds all the required parameters and settings necessary to export your layouts from Liferay DXP.

It’s that easy! To start your own export/import or staging process, you must create an ExportImportConfiguration object using a combination of the three provided ExportImportConfiguration factories (outlined here). Once you have your configuration object, provide it as a parameter in one of the many service methods available to you by the Export/Import or Staging interfaces to begin your desired process.

« Using the Export/Import Lifecycle Listener FrameworkStaging »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0