Example usage for com.liferay.portal.kernel.util MapUtil getString

List of usage examples for com.liferay.portal.kernel.util MapUtil getString

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util MapUtil getString.

Prototype

public static String getString(Map<String, ?> map, String key, String defaultValue) 

Source Link

Usage

From source file:com.liferay.asset.publisher.web.internal.exportimport.portlet.preferences.processor.AssetPublisherExportImportPortletPreferencesProcessor.java

License:Open Source License

@Override
protected Long getImportPortletPreferencesNewValue(PortletDataContext portletDataContext, Class<?> clazz,
        long companyGroupId, Map<Long, Long> primaryKeys, String portletPreferencesOldValue) throws Exception {

    if (Validator.isNumber(portletPreferencesOldValue)) {
        long oldPrimaryKey = GetterUtil.getLong(portletPreferencesOldValue);

        return MapUtil.getLong(primaryKeys, oldPrimaryKey, oldPrimaryKey);
    }// w  ww  .j av  a  2s.  c o  m

    String className = clazz.getName();

    String[] oldValues = StringUtil.split(portletPreferencesOldValue, StringPool.POUND);

    String uuid = oldValues[0];

    long groupId = portletDataContext.getScopeGroupId();

    if (oldValues.length > 1) {
        Map<Long, Long> groupIds = (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(Group.class);

        groupId = MapUtil.getLong(groupIds, GetterUtil.getLong(oldValues[1]), groupId);
    }

    if (className.equals(AssetCategory.class.getName())) {
        AssetCategory assetCategory = _assetCategoryLocalService.fetchAssetCategoryByUuidAndGroupId(uuid,
                groupId);

        if (assetCategory != null) {
            return assetCategory.getCategoryId();
        }
    } else if (className.equals(AssetVocabulary.class.getName())) {
        AssetVocabulary assetVocabulary = _assetVocabularyLocalService
                .fetchAssetVocabularyByUuidAndGroupId(uuid, groupId);

        if (assetVocabulary != null) {
            return assetVocabulary.getVocabularyId();
        }
    } else if (className.equals(DDMStructure.class.getName())) {
        DDMStructure ddmStructure = _ddmStructureLocalService.fetchDDMStructureByUuidAndGroupId(uuid, groupId);

        if (ddmStructure == null) {
            Map<String, String> structureUuids = (Map<String, String>) portletDataContext
                    .getNewPrimaryKeysMap(DDMStructure.class + ".ddmStructureUuid");

            String defaultStructureUuid = MapUtil.getString(structureUuids, uuid, uuid);

            ddmStructure = _ddmStructureLocalService.fetchDDMStructureByUuidAndGroupId(defaultStructureUuid,
                    groupId);
        }

        if (ddmStructure != null) {
            return ddmStructure.getStructureId();
        }
    } else if (className.equals(DLFileEntryType.class.getName())) {
        DLFileEntryType dlFileEntryType = _dlFileEntryTypeLocalService
                .fetchDLFileEntryTypeByUuidAndGroupId(uuid, groupId);

        if (dlFileEntryType == null) {
            Element rootElement = portletDataContext.getImportDataRootElement();

            Element element = portletDataContext.getReferenceElement(rootElement, clazz, companyGroupId, uuid,
                    PortletDataContext.REFERENCE_TYPE_DEPENDENCY);

            if (element != null) {
                String fileEntryTypeKey = element.attributeValue("file-entry-type-key");

                boolean preloaded = GetterUtil.getBoolean(element.attributeValue("preloaded"));

                if (preloaded) {
                    dlFileEntryType = _dlFileEntryTypeLocalService.fetchFileEntryType(companyGroupId,
                            fileEntryTypeKey);
                }
            }
        }

        if (dlFileEntryType != null) {
            return dlFileEntryType.getFileEntryTypeId();
        }
    }

    return null;
}

From source file:com.liferay.dynamic.data.mapping.service.permission.DDMStructurePermission.java

License:Open Source License

protected static String getAddStructureActionId(
        ServiceWrapper<DDMStructurePermissionSupport> structurePermissionSupportServiceWrapper) {

    Map<String, Object> properties = structurePermissionSupportServiceWrapper.getProperties();

    return MapUtil.getString(properties, "add.structure.action.id", DDMActionKeys.ADD_STRUCTURE);
}

From source file:com.liferay.dynamic.data.mapping.service.permission.DDMTemplatePermission.java

License:Open Source License

protected static String getAddTemplateActionId(
        ServiceWrapper<DDMTemplatePermissionSupport> templatePermissionSupportServiceWrapper) {

    Map<String, Object> properties = templatePermissionSupportServiceWrapper.getProperties();

    return MapUtil.getString(properties, "add.template.action.id", DDMActionKeys.ADD_TEMPLATE);
}

From source file:com.liferay.exportimport.content.processor.base.BaseTextExportImportContentProcessor.java

License:Open Source License

protected String replaceImportLinksToLayouts(PortletDataContext portletDataContext, String content)
        throws Exception {

    List<String> oldLinksToLayout = new ArrayList<>();
    List<String> newLinksToLayout = new ArrayList<>();

    Matcher matcher = importLinksToLayoutPattern.matcher(content);

    Map<Long, Long> layoutPlids = (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(Layout.class);

    String layoutsImportMode = MapUtil.getString(portletDataContext.getParameterMap(),
            PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE,
            PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE_MERGE_BY_LAYOUT_UUID);

    while (matcher.find()) {
        long oldPlid = GetterUtil.getLong(matcher.group(4));

        Long newPlid = MapUtil.getLong(layoutPlids, oldPlid);

        long oldGroupId = GetterUtil.getLong(matcher.group(6));

        long newGroupId = oldGroupId;

        long oldLayoutId = GetterUtil.getLong(matcher.group(1));

        long newLayoutId = oldLayoutId;

        Layout layout = LayoutLocalServiceUtil.fetchLayout(newPlid);

        if (layout != null) {
            newGroupId = layout.getGroupId();
            newLayoutId = layout.getLayoutId();
        } else if (_log.isDebugEnabled()) {
            StringBundler sb = new StringBundler(5);

            sb.append("Unable to get layout with plid ");
            sb.append(oldPlid);/*from w  w  w . j av a 2  s. c  om*/
            sb.append(", using layout ID  ");
            sb.append(newLayoutId);
            sb.append(" instead");

            _log.debug(sb.toString());
        }

        String oldLinkToLayout = matcher.group(0);

        String newLinkToLayout = StringUtil.replaceFirst(oldLinkToLayout,
                new String[] { StringPool.AT + oldPlid, String.valueOf(oldLayoutId) },
                new String[] { StringPool.BLANK, String.valueOf(newLayoutId) });

        if ((layout != null) && layout.isPublicLayout() && layoutsImportMode
                .equals(PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE_CREATED_FROM_PROTOTYPE)) {

            newLinkToLayout = StringUtil.replace(newLinkToLayout, "private-group", "public");
        }

        if ((oldGroupId != 0) && (oldGroupId != newGroupId)) {
            newLinkToLayout = StringUtil.replaceLast(newLinkToLayout, String.valueOf(oldGroupId),
                    String.valueOf(newGroupId));
        }

        oldLinksToLayout.add(oldLinkToLayout);
        newLinksToLayout.add(newLinkToLayout);
    }

    content = StringUtil.replace(content, ArrayUtil.toStringArray(oldLinksToLayout.toArray()),
            ArrayUtil.toStringArray(newLinksToLayout.toArray()));

    return content;
}

From source file:com.liferay.exportimport.controller.LayoutImportController.java

License:Open Source License

protected void doImportFile(PortletDataContext portletDataContext, long userId) throws Exception {

    Map<String, String[]> parameterMap = portletDataContext.getParameterMap();

    Group group = _groupLocalService.getGroup(portletDataContext.getGroupId());

    String layoutsImportMode = MapUtil.getString(parameterMap, PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE,
            PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE_MERGE_BY_LAYOUT_UUID);
    boolean permissions = MapUtil.getBoolean(parameterMap, PortletDataHandlerKeys.PERMISSIONS);

    if (group.isLayoutSetPrototype()) {
        parameterMap.put(PortletDataHandlerKeys.LAYOUT_SET_PROTOTYPE_LINK_ENABLED,
                new String[] { Boolean.FALSE.toString() });
    }//from   w w w  .  jav a 2 s.  co m

    if (_log.isDebugEnabled()) {
        _log.debug("Import permissions " + permissions);
    }

    StopWatch stopWatch = new StopWatch();

    stopWatch.start();

    LayoutCache layoutCache = new LayoutCache();

    long companyId = portletDataContext.getCompanyId();

    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();

    if (serviceContext == null) {
        serviceContext = new ServiceContext();
    }

    serviceContext.setCompanyId(companyId);
    serviceContext.setSignedIn(false);
    serviceContext.setUserId(userId);

    ServiceContextThreadLocal.pushServiceContext(serviceContext);

    // LAR validation

    validateFile(companyId, portletDataContext.getGroupId(), parameterMap, portletDataContext.getZipReader());

    // Source and target group id

    Map<Long, Long> groupIds = (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(Group.class);

    groupIds.put(portletDataContext.getSourceGroupId(), portletDataContext.getGroupId());

    // Manifest

    ManifestSummary manifestSummary = _exportImportHelper.getManifestSummary(portletDataContext);

    portletDataContext.setManifestSummary(manifestSummary);

    // Layout and layout set prototype

    Element rootElement = portletDataContext.getImportDataRootElement();

    Element headerElement = rootElement.element("header");

    String layoutSetPrototypeUuid = headerElement.attributeValue("layout-set-prototype-uuid");

    String larType = headerElement.attributeValue("type");

    portletDataContext.setType(larType);

    if (group.isLayoutPrototype() && larType.equals("layout-prototype")) {
        parameterMap.put(PortletDataHandlerKeys.DELETE_MISSING_LAYOUTS,
                new String[] { Boolean.FALSE.toString() });

        LayoutPrototype layoutPrototype = _layoutPrototypeLocalService.getLayoutPrototype(group.getClassPK());

        String layoutPrototypeUuid = GetterUtil.getString(headerElement.attributeValue("type-uuid"));

        LayoutPrototype existingLayoutPrototype = null;

        if (Validator.isNotNull(layoutPrototypeUuid)) {
            try {
                existingLayoutPrototype = _layoutPrototypeLocalService
                        .getLayoutPrototypeByUuidAndCompanyId(layoutPrototypeUuid, companyId);
            } catch (NoSuchLayoutPrototypeException nslpe) {

                // LPS-52675

                if (_log.isDebugEnabled()) {
                    _log.debug(nslpe, nslpe);
                }
            }
        }

        if (existingLayoutPrototype == null) {
            List<Layout> layouts = _layoutLocalService
                    .getLayoutsByLayoutPrototypeUuid(layoutPrototype.getUuid());

            layoutPrototype.setUuid(layoutPrototypeUuid);

            _layoutPrototypeLocalService.updateLayoutPrototype(layoutPrototype);

            for (Layout layout : layouts) {
                layout.setLayoutPrototypeUuid(layoutPrototypeUuid);

                _layoutLocalService.updateLayout(layout);
            }
        }
    } else if (group.isLayoutSetPrototype() && larType.equals("layout-set-prototype")) {

        parameterMap.put(PortletDataHandlerKeys.LAYOUT_SET_PROTOTYPE_SETTINGS,
                new String[] { Boolean.TRUE.toString() });

        LayoutSetPrototype layoutSetPrototype = _layoutSetPrototypeLocalService
                .getLayoutSetPrototype(group.getClassPK());

        String importedLayoutSetPrototypeUuid = GetterUtil.getString(headerElement.attributeValue("type-uuid"));

        LayoutSetPrototype existingLayoutSetPrototype = null;

        if (Validator.isNotNull(importedLayoutSetPrototypeUuid)) {
            try {
                existingLayoutSetPrototype = _layoutSetPrototypeLocalService
                        .getLayoutSetPrototypeByUuidAndCompanyId(importedLayoutSetPrototypeUuid, companyId);
            } catch (NoSuchLayoutSetPrototypeException nslspe) {

                // LPS-52675

                if (_log.isDebugEnabled()) {
                    _log.debug(nslspe, nslspe);
                }
            }
        }

        if (existingLayoutSetPrototype == null) {
            List<LayoutSet> layoutSets = _layoutSetLocalService
                    .getLayoutSetsByLayoutSetPrototypeUuid(layoutSetPrototype.getUuid());

            layoutSetPrototype.setUuid(importedLayoutSetPrototypeUuid);

            _layoutSetPrototypeLocalService.updateLayoutSetPrototype(layoutSetPrototype);

            for (LayoutSet curLayoutSet : layoutSets) {
                curLayoutSet.setLayoutSetPrototypeUuid(importedLayoutSetPrototypeUuid);

                _layoutSetLocalService.updateLayoutSet(curLayoutSet);
            }
        }
    } else if (larType.equals("layout-set-prototype")) {
        parameterMap.put(PortletDataHandlerKeys.LAYOUT_SET_PROTOTYPE_SETTINGS,
                new String[] { Boolean.TRUE.toString() });

        layoutSetPrototypeUuid = GetterUtil.getString(headerElement.attributeValue("type-uuid"));
    }

    if (Validator.isNotNull(layoutSetPrototypeUuid)) {
        portletDataContext.setLayoutSetPrototypeUuid(layoutSetPrototypeUuid);
    }

    List<Element> portletElements = fetchPortletElements(rootElement);

    if (permissions) {
        for (Element portletElement : portletElements) {
            String portletPath = portletElement.attributeValue("path");

            Document portletDocument = SAXReaderUtil.read(portletDataContext.getZipEntryAsString(portletPath));

            _permissionImporter.checkRoles(layoutCache, companyId, portletDataContext.getGroupId(), userId,
                    portletDocument.getRootElement());
        }

        _permissionImporter.readPortletDataPermissions(portletDataContext);
    }

    if (!layoutsImportMode.equals(PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE_CREATED_FROM_PROTOTYPE)) {

        _portletImportController.readExpandoTables(portletDataContext);
    }

    _portletImportController.readLocks(portletDataContext);

    // Import the group

    Element groupsElement = portletDataContext.getImportDataGroupElement(StagedGroup.class);

    for (Element groupElement : groupsElement.elements()) {
        StagedModelDataHandlerUtil.importStagedModel(portletDataContext, groupElement);
    }

    // Asset links

    _portletImportController.importAssetLinks(portletDataContext);

    // Site

    _groupLocalService.updateSite(portletDataContext.getGroupId(), true);

    if (_log.isInfoEnabled()) {
        _log.info("Importing layouts takes " + stopWatch.getTime() + " ms");
    }

    ZipReader zipReader = portletDataContext.getZipReader();

    zipReader.close();
}

From source file:com.liferay.exportimport.internal.content.processor.LinksToLayoutsExportImportContentProcessor.java

License:Open Source License

protected String replaceImportLinksToLayouts(PortletDataContext portletDataContext, String content)
        throws Exception {

    List<String> oldLinksToLayout = new ArrayList<>();
    List<String> newLinksToLayout = new ArrayList<>();

    Matcher matcher = _importLinksToLayoutPattern.matcher(content);

    Map<Long, Long> layoutPlids = (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(Layout.class);

    String layoutsImportMode = MapUtil.getString(portletDataContext.getParameterMap(),
            PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE,
            PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE_MERGE_BY_LAYOUT_UUID);

    while (matcher.find()) {
        long oldPlid = GetterUtil.getLong(matcher.group(4));

        Long newPlid = MapUtil.getLong(layoutPlids, oldPlid);

        long oldGroupId = GetterUtil.getLong(matcher.group(6));

        long newGroupId = oldGroupId;

        long oldLayoutId = GetterUtil.getLong(matcher.group(1));

        long newLayoutId = oldLayoutId;

        Layout layout = _layoutLocalService.fetchLayout(newPlid);

        if (layout != null) {
            newGroupId = layout.getGroupId();
            newLayoutId = layout.getLayoutId();
        } else if (_log.isWarnEnabled()) {
            _log.warn("Unable to get layout with plid " + oldPlid);
        }/*from w w  w . j  a  v a  2s.  co  m*/

        String oldLinkToLayout = matcher.group(0);

        String newLinkToLayout = StringUtil.replaceFirst(oldLinkToLayout,
                new String[] { StringPool.AT + oldPlid, String.valueOf(oldLayoutId) },
                new String[] { StringPool.BLANK, String.valueOf(newLayoutId) });

        if ((layout != null) && layout.isPublicLayout() && layoutsImportMode
                .equals(PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE_CREATED_FROM_PROTOTYPE)) {

            newLinkToLayout = StringUtil.replace(newLinkToLayout, "private-group", "public");
        }

        if ((oldGroupId != 0) && (oldGroupId != newGroupId)) {
            newLinkToLayout = StringUtil.replaceLast(newLinkToLayout, String.valueOf(oldGroupId),
                    String.valueOf(newGroupId));
        }

        oldLinksToLayout.add(oldLinkToLayout);
        newLinksToLayout.add(newLinkToLayout);
    }

    content = StringUtil.replace(content, ArrayUtil.toStringArray(oldLinksToLayout.toArray()),
            ArrayUtil.toStringArray(newLinksToLayout.toArray()));

    return content;
}

From source file:com.liferay.exportimport.lar.PortletDataContextFactoryImpl.java

License:Open Source License

@Override
public PortletDataContext createImportPortletDataContext(long companyId, long groupId,
        Map<String, String[]> parameterMap, UserIdStrategy userIdStrategy, ZipReader zipReader)
        throws PortletDataException {

    PortletDataContext portletDataContext = createPortletDataContext(companyId, groupId);

    String dataStrategy = MapUtil.getString(parameterMap, PortletDataHandlerKeys.DATA_STRATEGY,
            PortletDataHandlerKeys.DATA_STRATEGY_MIRROR);

    portletDataContext.setDataStrategy(dataStrategy);

    portletDataContext.setNewLayouts(new ArrayList<Layout>());
    portletDataContext.setParameterMap(parameterMap);
    portletDataContext.setUserIdStrategy(userIdStrategy);
    portletDataContext.setZipReader(zipReader);

    readXML(portletDataContext);/*from w  w w.  j  av  a 2  s  .c  om*/

    Map<Long, Long> groupIds = (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(Group.class);

    groupIds.put(portletDataContext.getSourceCompanyGroupId(), portletDataContext.getCompanyGroupId());

    return portletDataContext;
}

From source file:com.liferay.exportimport.staging.StagingImpl.java

License:Open Source License

@Override
public long publishLayouts(long userId, ExportImportConfiguration exportImportConfiguration)
        throws PortalException {

    Map<String, Serializable> settingsMap = exportImportConfiguration.getSettingsMap();

    Map<String, String[]> parameterMap = (Map<String, String[]>) settingsMap.get("parameterMap");

    String backgroundTaskName = MapUtil.getString(parameterMap, "name", exportImportConfiguration.getName());

    Map<String, Serializable> taskContextMap = new HashMap<>();

    taskContextMap.put("exportImportConfigurationId",
            exportImportConfiguration.getExportImportConfigurationId());

    boolean privateLayout = MapUtil.getBoolean(settingsMap, "privateLayout");

    taskContextMap.put("privateLayout", privateLayout);

    BackgroundTask backgroundTask = _backgroundTaskManager.addBackgroundTask(userId,
            exportImportConfiguration.getGroupId(), backgroundTaskName,
            BackgroundTaskExecutorNames.LAYOUT_STAGING_BACKGROUND_TASK_EXECUTOR, taskContextMap,
            new ServiceContext());

    return backgroundTask.getBackgroundTaskId();
}

From source file:com.liferay.exportimport.staging.StagingImpl.java

License:Open Source License

protected long doCopyRemoteLayouts(ExportImportConfiguration exportImportConfiguration, String remoteAddress,
        int remotePort, String remotePathContext, boolean secureConnection, boolean remotePrivateLayout)
        throws PortalException {

    Map<String, Serializable> settingsMap = exportImportConfiguration.getSettingsMap();

    Map<String, String[]> parameterMap = (Map<String, String[]>) settingsMap.get("parameterMap");

    String backgroundTaskName = MapUtil.getString(parameterMap, "name", exportImportConfiguration.getName());

    Map<String, Serializable> taskContextMap = new HashMap<>();

    taskContextMap.put("exportImportConfigurationId",
            exportImportConfiguration.getExportImportConfigurationId());

    String remoteURL = buildRemoteURL(remoteAddress, remotePort, remotePathContext, secureConnection);

    PermissionChecker permissionChecker = PermissionThreadLocal.getPermissionChecker();

    User user = permissionChecker.getUser();

    HttpPrincipal httpPrincipal = new HttpPrincipal(remoteURL, user.getLogin(), user.getPassword(),
            user.getPasswordEncrypted());

    taskContextMap.put("httpPrincipal", httpPrincipal);

    taskContextMap.put("privateLayout", remotePrivateLayout);

    BackgroundTask backgroundTask = _backgroundTaskManager.addBackgroundTask(user.getUserId(),
            exportImportConfiguration.getGroupId(), backgroundTaskName,
            BackgroundTaskExecutorNames.LAYOUT_REMOTE_STAGING_BACKGROUND_TASK_EXECUTOR, taskContextMap,
            new ServiceContext());

    return backgroundTask.getBackgroundTaskId();
}

From source file:com.liferay.journal.content.web.internal.exportimport.portlet.preferences.processor.JournalContentExportImportPortletPreferencesProcessor.java

License:Open Source License

@Override
public PortletPreferences processImportPortletPreferences(PortletDataContext portletDataContext,
        PortletPreferences portletPreferences) throws PortletDataException {

    try {/*from  w w  w. j  av a2 s .c om*/
        portletDataContext.importPortletPermissions(JournalPermission.RESOURCE_NAME);
    } catch (PortalException pe) {
        throw new PortletDataException("Unable to import portlet permissions", pe);
    }

    long previousScopeGroupId = portletDataContext.getScopeGroupId();
    String previousScopeType = portletDataContext.getScopeType();

    Map<Long, Long> groupIds = (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(Group.class);

    long importGroupId = GetterUtil.getLong(portletPreferences.getValue("groupId", null));

    if ((importGroupId == portletDataContext.getCompanyGroupId())
            && MergeLayoutPrototypesThreadLocal.isInProgress()) {

        portletDataContext.setScopeType("company");
    }

    long groupId = MapUtil.getLong(groupIds, importGroupId, importGroupId);

    portletDataContext.setScopeGroupId(groupId);

    String articleId = portletPreferences.getValue("articleId", null);

    try {
        if (Validator.isNotNull(articleId)) {
            Group importedArticleGroup = _groupLocalService.getGroup(groupId);

            if (importedArticleGroup.isStagedPortlet(JournalPortletKeys.JOURNAL)) {

                Map<String, String> articleIds = (Map<String, String>) portletDataContext
                        .getNewPrimaryKeysMap(JournalArticle.class + ".articleId");

                articleId = MapUtil.getString(articleIds, articleId, articleId);

                portletPreferences.setValue("articleId", articleId);

                portletPreferences.setValue("groupId", String.valueOf(groupId));

                if (portletDataContext.getPlid() > 0) {
                    Layout layout = _layoutLocalService.fetchLayout(portletDataContext.getPlid());

                    _journalContentSearchLocalService.updateContentSearch(layout.getGroupId(),
                            layout.isPrivateLayout(), layout.getLayoutId(), portletDataContext.getPortletId(),
                            articleId, true);
                }
            }
        }

        String ddmTemplateKey = portletPreferences.getValue("ddmTemplateKey", null);

        if (Validator.isNotNull(ddmTemplateKey)) {
            Map<String, String> ddmTemplateKeys = (Map<String, String>) portletDataContext
                    .getNewPrimaryKeysMap(DDMTemplate.class + ".ddmTemplateKey");

            ddmTemplateKey = MapUtil.getString(ddmTemplateKeys, ddmTemplateKey, ddmTemplateKey);

            portletPreferences.setValue("ddmTemplateKey", ddmTemplateKey);
        }
    } catch (PortalException pe) {
        throw new PortletDataException("Unable to update journal content search data during import", pe);
    } catch (ReadOnlyException roe) {
        throw new PortletDataException("Unable to update portlet preferences during import", roe);
    }

    portletDataContext.setScopeGroupId(previousScopeGroupId);
    portletDataContext.setScopeType(previousScopeType);

    return portletPreferences;
}