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.
-
Use the
ExportImportConfigurationSettingsMapFactory
class to create a layout export settings map:Map<String, Serializable> exportLayoutSettingsMap = ExportImportConfigurationSettingsMapFactory. buildExportLayoutSettingsMap(...);
-
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 theExportImportConfiguration
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
. -
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.