Search in sources :

Example 1 with ExportImportConfiguration

use of com.liferay.exportimport.kernel.model.ExportImportConfiguration in project liferay-imex by jpdacunha.

the class SiteExporter method doExportLar.

private void doExportLar(User user, Properties config, Group group, File siteDir, Locale locale, boolean privateLayout, boolean debug) throws PortalException {
    int exportType = ExportImportConfigurationConstants.TYPE_EXPORT_LAYOUT;
    String prefix = EXPORT_SITE_PUBLIC_PAGE_PARAMETER_PREFIX;
    if (privateLayout) {
        prefix = EXPORT_SITE_PRIVATE_PAGE_PARAMETER_PREFIX;
    }
    long groupId = group.getGroupId();
    long userId = user.getUserId();
    String name = "IMEX : site export process";
    String description = "This an automatic site export triggered by IMEX";
    long[] layoutIds = SiteCommonUtil.ALL_LAYOUTS;
    Map<String, String[]> parameterMap = larService.buildParameterMapFromProperties(config, prefix);
    Map<String, Serializable> settingsMap = ExportImportConfigurationSettingsMapFactoryUtil.buildExportLayoutSettingsMap(user, groupId, privateLayout, layoutIds, parameterMap);
    ExportImportConfiguration exportImportConfiguration = larService.createExportImportConfiguration(groupId, userId, name, description, exportType, settingsMap, new ServiceContext());
    String fileName = FileNames.getLarSiteFileName(group, privateLayout);
    larService.doExport(exportImportConfiguration, siteDir, fileName);
}
Also used : Serializable(java.io.Serializable) ExportImportConfiguration(com.liferay.exportimport.kernel.model.ExportImportConfiguration) ServiceContext(com.liferay.portal.kernel.service.ServiceContext)

Example 2 with ExportImportConfiguration

use of com.liferay.exportimport.kernel.model.ExportImportConfiguration in project liferay-imex by jpdacunha.

the class SiteImporter method doImportLar.

private void doImportLar(File groupDir, Properties config, User user, Group group, Locale locale, boolean debug, String prefix, boolean privateLayout) throws Exception {
    long groupId = group.getGroupId();
    long userId = user.getUserId();
    String name = "IMEX : site import process";
    String description = "This an automatic site import triggered by IMEX";
    long[] layoutIds = SiteCommonUtil.ALL_LAYOUTS;
    Map<String, String[]> parameterMap = null;
    Map<String, Serializable> settingsMap = null;
    int importType = ExportImportConfigurationConstants.TYPE_IMPORT_LAYOUT;
    String larFileName = FileNames.getLarSiteFileName(group, privateLayout);
    try {
        parameterMap = larService.buildParameterMapFromProperties(config, prefix);
        settingsMap = ExportImportConfigurationSettingsMapFactoryUtil.buildImportLayoutSettingsMap(user, groupId, privateLayout, layoutIds, parameterMap);
        ExportImportConfiguration exportImportConfiguration = larService.createExportImportConfiguration(groupId, userId, name, description, importType, settingsMap, new ServiceContext());
        larService.doImport(user, exportImportConfiguration, groupDir, larFileName);
    } catch (LARFileNameException e) {
        reportService.getMessage(_log, group.getFriendlyURL(), "[" + larFileName + "] is missing in [" + groupDir.getAbsolutePath() + "]");
        if (debug) {
            _log.error(e, e);
        }
    }
}
Also used : Serializable(java.io.Serializable) LARFileNameException(com.liferay.exportimport.kernel.exception.LARFileNameException) ExportImportConfiguration(com.liferay.exportimport.kernel.model.ExportImportConfiguration) ServiceContext(com.liferay.portal.kernel.service.ServiceContext)

Aggregations

ExportImportConfiguration (com.liferay.exportimport.kernel.model.ExportImportConfiguration)2 ServiceContext (com.liferay.portal.kernel.service.ServiceContext)2 Serializable (java.io.Serializable)2 LARFileNameException (com.liferay.exportimport.kernel.exception.LARFileNameException)1