Search in sources :

Example 1 with LARFileNameException

use of com.liferay.exportimport.kernel.exception.LARFileNameException 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

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