Example usage for com.liferay.portal.kernel.util PortletKeys PREFS_OWNER_TYPE_COMPANY

List of usage examples for com.liferay.portal.kernel.util PortletKeys PREFS_OWNER_TYPE_COMPANY

Introduction

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

Prototype

int PREFS_OWNER_TYPE_COMPANY

To view the source code for com.liferay.portal.kernel.util PortletKeys PREFS_OWNER_TYPE_COMPANY.

Click Source Link

Usage

From source file:com.liferay.application.list.my.account.permissions.internal.PanelAppMyAccountPermissions.java

License:Open Source License

private void _initPermissions(long companyId, String portletId, String rootPortletId, Role userRole,
        List<String> actionIds) throws Exception {

    PortletPreferences portletPreferences = _portletPreferencesFactory.getLayoutPortletSetup(companyId,
            companyId, PortletKeys.PREFS_OWNER_TYPE_COMPANY, LayoutConstants.DEFAULT_PLID, portletId,
            PortletConstants.DEFAULT_PREFERENCES);

    if (_prefsProps.getBoolean(portletPreferences, "myAccountAccessInControlPanelPermissionsInitialized")) {

        return;//from   ww  w  .  j a  v  a2s  .co  m
    }

    if (actionIds.contains(ActionKeys.ACCESS_IN_CONTROL_PANEL)) {
        _resourcePermissionLocalService.addResourcePermission(companyId, rootPortletId,
                ResourceConstants.SCOPE_COMPANY, String.valueOf(companyId), userRole.getRoleId(),
                ActionKeys.ACCESS_IN_CONTROL_PANEL);
    }

    portletPreferences.setValue("myAccountAccessInControlPanelPermissionsInitialized", StringPool.TRUE);

    portletPreferences.store();
}

From source file:com.liferay.application.list.my.account.permissions.test.PanelAppMyAccountPermissionsTest.java

License:Open Source License

@After
public void tearDown() throws Exception {
    for (ServiceRegistration<?> serviceRegistration : _serviceRegistrations) {

        serviceRegistration.unregister();
    }/*from  w ww  .  j  a v a  2 s .c  o  m*/

    _serviceRegistrations.clear();

    PortletPreferencesLocalServiceUtil.deletePortletPreferences(TestPropsValues.getCompanyId(),
            PortletKeys.PREFS_OWNER_TYPE_COMPANY, LayoutConstants.DEFAULT_PLID, _testPortletId);
}

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

License:Open Source License

public void exportPortlet(PortletDataContext portletDataContext, long plid, Element parentElement,
        boolean exportPermissions, boolean exportPortletArchivedSetups, boolean exportPortletData,
        boolean exportPortletSetup, boolean exportPortletUserPreferences) throws Exception {

    long layoutId = LayoutConstants.DEFAULT_PARENT_LAYOUT_ID;

    Layout layout = _layoutLocalService.fetchLayout(plid);

    if (layout != null) {
        layoutId = layout.getLayoutId();
    }// www. j av  a2s.  com

    Portlet portlet = _portletLocalService.getPortletById(portletDataContext.getCompanyId(),
            portletDataContext.getPortletId());

    if ((portlet == null) || portlet.isUndeployedPortlet()) {
        if (_log.isDebugEnabled()) {
            _log.debug("Do not export portlet " + portletDataContext.getPortletId()
                    + " because the portlet is not deployed");
        }

        return;
    }

    if (!portlet.isInstanceable() && !portlet.isPreferencesUniquePerLayout()
            && portletDataContext.hasNotUniquePerLayout(portletDataContext.getPortletId())) {

        return;
    }

    if (BackgroundTaskThreadLocal.hasBackgroundTask()) {
        PortletDataContext clonedPortletDataContext = _portletDataContextFactory
                .clonePortletDataContext(portletDataContext);

        ManifestSummary manifestSummary = clonedPortletDataContext.getManifestSummary();

        manifestSummary.resetCounters();

        PortletDataHandler portletDataHandler = portlet.getPortletDataHandlerInstance();

        portletDataHandler.prepareManifestSummary(clonedPortletDataContext);

        _portletDataHandlerStatusMessageSender.sendStatusMessage("portlet", portletDataContext.getPortletId(),
                manifestSummary);
    }

    Document document = SAXReaderUtil.createDocument();

    Element portletElement = document.addElement("portlet");

    portletElement.addAttribute("portlet-id", portletDataContext.getPortletId());
    portletElement.addAttribute("root-portlet-id", portletDataContext.getRootPortletId());
    portletElement.addAttribute("old-plid", String.valueOf(plid));
    portletElement.addAttribute("scope-group-id", String.valueOf(portletDataContext.getScopeGroupId()));
    portletElement.addAttribute("scope-layout-type", portletDataContext.getScopeType());
    portletElement.addAttribute("scope-layout-uuid", portletDataContext.getScopeLayoutUuid());
    portletElement.addAttribute("private-layout", String.valueOf(portletDataContext.isPrivateLayout()));

    // Data

    if (exportPortletData) {
        javax.portlet.PortletPreferences jxPortletPreferences = null;

        if (ExportImportThreadLocal.isInitialLayoutStagingInProcess()) {
            if (layout != null) {
                Group liveGroup = layout.getGroup();

                Group stagingGroup = liveGroup.getStagingGroup();

                layout.setGroupId(stagingGroup.getGroupId());

                jxPortletPreferences = PortletPreferencesFactoryUtil.getStrictPortletSetup(layout,
                        portletDataContext.getPortletId());

                layout.setGroupId(liveGroup.getGroupId());
            } else {
                Group liveGroup = _groupLocalService.getGroup(portletDataContext.getGroupId());

                Group stagingGroup = liveGroup.getStagingGroup();

                jxPortletPreferences = PortletPreferencesFactoryUtil.getStrictPortletSetup(
                        portletDataContext.getCompanyId(), stagingGroup.getGroupId(),
                        portletDataContext.getPortletId());
            }
        } else {
            if (layout != null) {
                jxPortletPreferences = PortletPreferencesFactoryUtil.getStrictPortletSetup(layout,
                        portletDataContext.getPortletId());
            } else {
                jxPortletPreferences = PortletPreferencesFactoryUtil.getStrictPortletSetup(
                        portletDataContext.getCompanyId(), portletDataContext.getGroupId(),
                        portletDataContext.getPortletId());
            }
        }

        if (!portlet.isPreferencesUniquePerLayout()) {
            StringBundler sb = new StringBundler(5);

            sb.append(portletDataContext.getPortletId());
            sb.append(StringPool.AT);
            sb.append(portletDataContext.getScopeType());
            sb.append(StringPool.AT);
            sb.append(portletDataContext.getScopeLayoutUuid());

            String dataKey = sb.toString();

            if (!portletDataContext.hasNotUniquePerLayout(dataKey)) {
                portletDataContext.putNotUniquePerLayout(dataKey);

                exportPortletData(portletDataContext, portlet, layout, jxPortletPreferences, portletElement);
            }
        } else {
            exportPortletData(portletDataContext, portlet, layout, jxPortletPreferences, portletElement);
        }
    }

    // Portlet preferences

    if (exportPortletSetup) {

        // Company

        exportPortletPreferences(portletDataContext, portletDataContext.getCompanyId(),
                PortletKeys.PREFS_OWNER_TYPE_COMPANY, false, layout, plid, portlet.getRootPortletId(),
                portletElement);

        // Group

        exportPortletPreferences(portletDataContext, portletDataContext.getScopeGroupId(),
                PortletKeys.PREFS_OWNER_TYPE_GROUP, false, layout, PortletKeys.PREFS_PLID_SHARED,
                portlet.getRootPortletId(), portletElement);

        // Group embedded portlets

        exportPortletPreferences(portletDataContext, portletDataContext.getScopeGroupId(),
                PortletKeys.PREFS_OWNER_TYPE_LAYOUT, false, layout, PortletKeys.PREFS_PLID_SHARED,
                portlet.getPortletId(), portletElement);

        // Layout

        exportPortletPreferences(portletDataContext, PortletKeys.PREFS_OWNER_ID_DEFAULT,
                PortletKeys.PREFS_OWNER_TYPE_LAYOUT, false, layout, plid, portletDataContext.getPortletId(),
                portletElement);
    }

    // Portlet user preferences

    if (exportPortletUserPreferences) {
        List<PortletPreferences> portletPreferencesList = _portletPreferencesLocalService.getPortletPreferences(
                PortletKeys.PREFS_OWNER_TYPE_USER, plid, portletDataContext.getPortletId());

        for (PortletPreferences portletPreferences : portletPreferencesList) {

            boolean defaultUser = false;

            if (portletPreferences.getOwnerId() == PortletKeys.PREFS_OWNER_ID_DEFAULT) {

                defaultUser = true;
            }

            exportPortletPreferences(portletDataContext, portletPreferences.getOwnerId(),
                    PortletKeys.PREFS_OWNER_TYPE_USER, defaultUser, layout, plid,
                    portletDataContext.getPortletId(), portletElement);
        }

        try {
            PortletPreferences groupPortletPreferences = _portletPreferencesLocalService.getPortletPreferences(
                    portletDataContext.getScopeGroupId(), PortletKeys.PREFS_OWNER_TYPE_GROUP,
                    PortletKeys.PREFS_PLID_SHARED, portlet.getRootPortletId());

            exportPortletPreference(portletDataContext, portletDataContext.getScopeGroupId(),
                    PortletKeys.PREFS_OWNER_TYPE_GROUP, false, groupPortletPreferences,
                    portlet.getRootPortletId(), PortletKeys.PREFS_PLID_SHARED, portletElement);
        } catch (NoSuchPortletPreferencesException nsppe) {

            // LPS-52675

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

    // Archived setups

    if (exportPortletArchivedSetups) {
        List<PortletItem> portletItems = _portletItemLocalService.getPortletItems(
                portletDataContext.getGroupId(), portletDataContext.getRootPortletId(),
                PortletPreferences.class.getName());

        for (PortletItem portletItem : portletItems) {
            exportPortletPreferences(portletDataContext, portletItem.getPortletItemId(),
                    PortletKeys.PREFS_OWNER_TYPE_ARCHIVED, false, null, plid, portletItem.getPortletId(),
                    portletElement);
        }
    }

    // Permissions

    if (exportPermissions) {
        _permissionExporter.exportPortletPermissions(portletDataContext, portletDataContext.getPortletId(),
                layout, portletElement);
    }

    // Zip

    StringBundler pathSB = new StringBundler(4);

    pathSB.append(ExportImportPathUtil.getPortletPath(portletDataContext));
    pathSB.append(StringPool.SLASH);
    pathSB.append(plid);
    pathSB.append("/portlet.xml");

    String path = pathSB.toString();

    Element element = parentElement.addElement("portlet");

    element.addAttribute("portlet-id", portletDataContext.getPortletId());
    element.addAttribute("layout-id", String.valueOf(layoutId));
    element.addAttribute("path", path);
    element.addAttribute("portlet-data", String.valueOf(exportPortletData));

    PortletDataHandler portletDataHandler = portlet.getPortletDataHandlerInstance();

    element.addAttribute("schema-version", portletDataHandler.getSchemaVersion());

    StringBundler configurationOptionsSB = new StringBundler(6);

    if (exportPortletSetup) {
        configurationOptionsSB.append("setup");
        configurationOptionsSB.append(StringPool.COMMA);
    }

    if (exportPortletArchivedSetups) {
        configurationOptionsSB.append("archived-setups");
        configurationOptionsSB.append(StringPool.COMMA);
    }

    if (exportPortletUserPreferences) {
        configurationOptionsSB.append("user-preferences");
        configurationOptionsSB.append(StringPool.COMMA);
    }

    if (configurationOptionsSB.index() > 0) {
        configurationOptionsSB.setIndex(configurationOptionsSB.index() - 1);
    }

    element.addAttribute("portlet-configuration", configurationOptionsSB.toString());

    try {
        portletDataContext.addZipEntry(path, document.formattedString());
    } catch (IOException ioe) {
        if (_log.isWarnEnabled()) {
            _log.warn(ioe.getMessage());
        }
    }
}

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

License:Open Source License

public void exportService(PortletDataContext portletDataContext, Element rootElement,
        boolean exportServiceSetup) throws Exception {

    if (!exportServiceSetup) {
        return;//from   w  w w  .  j  a  v  a2s.c o  m
    }

    PortletDataHandler portletDataHandler = _portletDataHandlerProvider
            .provide(portletDataContext.getPortletId());

    if (portletDataHandler == null) {
        return;
    }

    String serviceName = portletDataHandler.getServiceName();

    if (Validator.isNotNull(serviceName)) {

        // Company service

        exportServicePortletPreferences(portletDataContext, portletDataContext.getCompanyId(),
                PortletKeys.PREFS_OWNER_TYPE_COMPANY, serviceName, rootElement);

        // Group service

        exportServicePortletPreferences(portletDataContext, portletDataContext.getScopeGroupId(),
                PortletKeys.PREFS_OWNER_TYPE_GROUP, serviceName, rootElement);
    }
}

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

License:Open Source License

protected PortletPreferences getPortletPreferences(long ownerId, int ownerType, long plid, String portletId)
        throws PortalException {

    PortletPreferences portletPreferences = null;

    if ((ownerType == PortletKeys.PREFS_OWNER_TYPE_ARCHIVED)
            || (ownerType == PortletKeys.PREFS_OWNER_TYPE_COMPANY)
            || (ownerType == PortletKeys.PREFS_OWNER_TYPE_GROUP)) {

        portletPreferences = _portletPreferencesLocalService.getPortletPreferences(ownerId, ownerType,
                LayoutConstants.DEFAULT_PLID, portletId);
    } else {/*w  w w .j a v  a  2  s  .  co  m*/
        portletPreferences = _portletPreferencesLocalService.getPortletPreferences(ownerId, ownerType, plid,
                portletId);
    }

    return portletPreferences;
}

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

License:Open Source License

public void importPortletPreferences(PortletDataContext portletDataContext, long companyId, long groupId,
        Layout layout, Element parentElement, boolean preserveScopeLayoutId,
        boolean importPortletArchivedSetups, boolean importPortletData, boolean importPortletSetup,
        boolean importPortletUserPreferences) throws Exception {

    long plid = LayoutConstants.DEFAULT_PLID;
    String scopeType = StringPool.BLANK;
    String scopeLayoutUuid = StringPool.BLANK;

    if (layout != null) {
        plid = layout.getPlid();//w w  w  . j  a v  a2 s . c o m

        if (preserveScopeLayoutId) {
            javax.portlet.PortletPreferences jxPortletPreferences = PortletPreferencesFactoryUtil
                    .getLayoutPortletSetup(layout, portletDataContext.getPortletId());

            scopeType = GetterUtil.getString(jxPortletPreferences.getValue("lfrScopeType", null));
            scopeLayoutUuid = GetterUtil.getString(jxPortletPreferences.getValue("lfrScopeLayoutUuid", null));

            portletDataContext.setScopeType(scopeType);
            portletDataContext.setScopeLayoutUuid(scopeLayoutUuid);
        }
    }

    List<Element> portletPreferencesElements = parentElement.elements("portlet-preferences");

    for (Element portletPreferencesElement : portletPreferencesElements) {
        String path = portletPreferencesElement.attributeValue("path");

        if (portletDataContext.isPathNotProcessed(path)) {
            String xml = null;

            Element element = null;

            try {
                xml = portletDataContext.getZipEntryAsString(path);

                Document preferencesDocument = SAXReaderUtil.read(xml);

                element = preferencesDocument.getRootElement();
            } catch (DocumentException de) {
                throw new SystemException(
                        "Unable to parse XML portlet preferences for portlet "
                                + portletDataContext.getPortletId() + " while importing portlet preferences",
                        de);
            }

            long ownerId = GetterUtil.getLong(element.attributeValue("owner-id"));
            int ownerType = GetterUtil.getInteger(element.attributeValue("owner-type"));

            if ((ownerType == PortletKeys.PREFS_OWNER_TYPE_COMPANY) || !importPortletSetup) {

                continue;
            }

            if ((ownerType == PortletKeys.PREFS_OWNER_TYPE_ARCHIVED) && !importPortletArchivedSetups) {

                continue;
            }

            if ((ownerType == PortletKeys.PREFS_OWNER_TYPE_USER)
                    && (ownerId != PortletKeys.PREFS_OWNER_ID_DEFAULT) && !importPortletUserPreferences) {

                continue;
            }

            long curPlid = plid;
            String curPortletId = portletDataContext.getPortletId();

            if (ownerType == PortletKeys.PREFS_OWNER_TYPE_GROUP) {
                curPlid = PortletKeys.PREFS_PLID_SHARED;
                curPortletId = portletDataContext.getRootPortletId();
                ownerId = portletDataContext.getScopeGroupId();
            }

            long elementPlid = GetterUtil.getLong(element.attributeValue("plid"));

            if ((ownerType == PortletKeys.PREFS_OWNER_TYPE_LAYOUT)
                    && (ownerId != PortletKeys.PREFS_OWNER_ID_DEFAULT)
                    && (elementPlid == PortletKeys.PREFS_PLID_SHARED)) {

                curPlid = PortletKeys.PREFS_PLID_SHARED;
                ownerId = portletDataContext.getScopeGroupId();
            }

            if (ownerType == PortletKeys.PREFS_OWNER_TYPE_ARCHIVED) {
                String userUuid = element.attributeValue("archive-user-uuid");

                long userId = portletDataContext.getUserId(userUuid);

                String name = element.attributeValue("archive-name");

                curPortletId = portletDataContext.getRootPortletId();

                PortletItem portletItem = _portletItemLocalService.updatePortletItem(userId, groupId, name,
                        curPortletId, PortletPreferences.class.getName());

                curPlid = LayoutConstants.DEFAULT_PLID;
                ownerId = portletItem.getPortletItemId();
            }

            if (ownerType == PortletKeys.PREFS_OWNER_TYPE_USER) {
                String userUuid = element.attributeValue("user-uuid");

                ownerId = portletDataContext.getUserId(userUuid);
            }

            boolean defaultUser = GetterUtil.getBoolean(element.attributeValue("default-user"));

            if (defaultUser) {
                ownerId = _userLocalService.getDefaultUserId(companyId);
            }

            javax.portlet.PortletPreferences jxPortletPreferences = PortletPreferencesFactoryUtil
                    .fromXML(companyId, ownerId, ownerType, curPlid, curPortletId, xml);

            Element importDataRootElement = portletDataContext.getImportDataRootElement();

            try {
                Element preferenceDataElement = portletPreferencesElement.element("preference-data");

                if (preferenceDataElement != null) {
                    portletDataContext.setImportDataRootElement(preferenceDataElement);
                }

                ExportImportPortletPreferencesProcessor exportImportPortletPreferencesProcessor = ExportImportPortletPreferencesProcessorRegistryUtil
                        .getExportImportPortletPreferencesProcessor(
                                PortletIdCodec.decodePortletName(curPortletId));

                if (exportImportPortletPreferencesProcessor != null) {
                    List<Capability> importCapabilities = exportImportPortletPreferencesProcessor
                            .getImportCapabilities();

                    if (ListUtil.isNotEmpty(importCapabilities)) {
                        for (Capability importCapability : importCapabilities) {

                            importCapability.process(portletDataContext, jxPortletPreferences);
                        }
                    }

                    exportImportPortletPreferencesProcessor.processImportPortletPreferences(portletDataContext,
                            jxPortletPreferences);
                } else {
                    PortletDataHandler portletDataHandler = _portletDataHandlerProvider
                            .provide(portletDataContext.getCompanyId(), curPortletId);

                    if (portletDataHandler != null) {
                        jxPortletPreferences = portletDataHandler.processImportPortletPreferences(
                                portletDataContext, curPortletId, jxPortletPreferences);
                    }
                }
            } finally {
                portletDataContext.setImportDataRootElement(importDataRootElement);
            }

            updatePortletPreferences(portletDataContext, ownerId, ownerType, curPlid, curPortletId,
                    PortletPreferencesFactoryUtil.toXML(jxPortletPreferences), importPortletData);
        }
    }

    if (preserveScopeLayoutId && (layout != null)) {
        javax.portlet.PortletPreferences jxPortletPreferences = PortletPreferencesFactoryUtil
                .getLayoutPortletSetup(layout, portletDataContext.getPortletId());

        try {
            jxPortletPreferences.setValue("lfrScopeType", scopeType);
            jxPortletPreferences.setValue("lfrScopeLayoutUuid", scopeLayoutUuid);

            jxPortletPreferences.store();
        } finally {
            portletDataContext.setScopeType(scopeType);
            portletDataContext.setScopeLayoutUuid(scopeLayoutUuid);
        }
    }
}

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

License:Open Source License

public void importServicePortletPreferences(PortletDataContext portletDataContext, Element serviceElement)
        throws PortalException {

    long ownerId = GetterUtil.getLong(serviceElement.attributeValue("owner-id"));
    int ownerType = GetterUtil.getInteger(serviceElement.attributeValue("owner-type"));
    String serviceName = serviceElement.attributeValue("service-name");

    if (ownerType == PortletKeys.PREFS_OWNER_TYPE_GROUP) {
        ownerId = portletDataContext.getGroupId();
    } else if (ownerType == PortletKeys.PREFS_OWNER_TYPE_COMPANY) {
        ownerId = portletDataContext.getCompanyId();
    }/* w  ww.ja v  a  2 s. com*/

    PortletPreferences portletPreferences = getPortletPreferences(portletDataContext.getCompanyId(), ownerId,
            ownerType, LayoutConstants.DEFAULT_PLID, serviceName);

    for (Attribute attribute : serviceElement.attributes()) {
        serviceElement.remove(attribute);
    }

    String xml = serviceElement.asXML();

    portletPreferences.setPreferences(xml);

    _portletPreferencesLocalService.updatePortletPreferences(portletPreferences);
}

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

License:Open Source License

protected PortletPreferences getPortletPreferences(long companyId, long ownerId, int ownerType, long plid,
        String serviceName) throws PortalException {

    PortletPreferences portletPreferences = null;

    try {//  w  ww  .  jav a  2s  . com
        if ((ownerType == PortletKeys.PREFS_OWNER_TYPE_ARCHIVED)
                || (ownerType == PortletKeys.PREFS_OWNER_TYPE_COMPANY)
                || (ownerType == PortletKeys.PREFS_OWNER_TYPE_GROUP)) {

            portletPreferences = _portletPreferencesLocalService.getPortletPreferences(ownerId, ownerType,
                    LayoutConstants.DEFAULT_PLID, serviceName);
        } else {
            portletPreferences = _portletPreferencesLocalService.getPortletPreferences(ownerId, ownerType, plid,
                    serviceName);
        }
    } catch (NoSuchPortletPreferencesException nsppe) {

        // LPS-52675

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

        portletPreferences = _portletPreferencesLocalService.addPortletPreferences(companyId, ownerId,
                ownerType, plid, serviceName, null, null);
    }

    return portletPreferences;
}

From source file:com.liferay.journal.exportimport.data.handler.test.JournalFeedStagedModelDataHandlerTest.java

License:Open Source License

@Before
@Override//from  w  ww .  j a  va 2  s .  co  m
public void setUp() throws Exception {
    super.setUp();

    _layout = LayoutTestUtil.addLayout(stagingGroup);

    ServiceContext serviceContext = new ServiceContext();

    serviceContext.setUuid(_layout.getUuid());

    LayoutLocalServiceUtil.addLayout(TestPropsValues.getUserId(), liveGroup.getGroupId(),
            _layout.getPrivateLayout(), _layout.getParentLayoutId(), _layout.getName(), _layout.getTitle(),
            _layout.getDescription(), _layout.getType(), _layout.getHidden(), _layout.getFriendlyURL(),
            serviceContext);

    CompanyThreadLocal.setCompanyId(TestPropsValues.getCompanyId());

    serviceContext.setCompanyId(TestPropsValues.getCompanyId());

    PortalPreferences portalPreferenceces = PortletPreferencesFactoryUtil
            .getPortalPreferences(TestPropsValues.getUserId(), true);

    _originalPortalPreferencesXML = PortletPreferencesFactoryUtil.toXML(portalPreferenceces);

    portalPreferenceces.setValue("", "publishToLiveByDefaultEnabled", "true");
    portalPreferenceces.setValue("", "versionHistoryByDefaultEnabled", "true");
    portalPreferenceces.setValue("", "articleCommentsEnabled", "true");
    portalPreferenceces.setValue("", "expireAllArticleVersionsEnabled", "true");
    portalPreferenceces.setValue("", "folderIconCheckCountEnabled", "true");
    portalPreferenceces.setValue("", "indexAllArticleVersionsEnabled", "true");
    portalPreferenceces.setValue("", "databaseContentKeywordSearchEnabled", "true");
    portalPreferenceces.setValue("", "journalArticleStorageType", "json");
    portalPreferenceces.setValue("", "journalArticlePageBreakToken", "@page_break@");

    PortalPreferencesLocalServiceUtil.updatePreferences(TestPropsValues.getCompanyId(),
            PortletKeys.PREFS_OWNER_TYPE_COMPANY, PortletPreferencesFactoryUtil.toXML(portalPreferenceces));
}

From source file:com.liferay.journal.exportimport.data.handler.test.JournalFeedStagedModelDataHandlerTest.java

License:Open Source License

@After
@Override//from  ww  w  .  j  a  v  a 2  s .co m
public void tearDown() throws Exception {
    super.tearDown();

    PortalPreferencesLocalServiceUtil.updatePreferences(TestPropsValues.getCompanyId(),
            PortletKeys.PREFS_OWNER_TYPE_COMPANY, _originalPortalPreferencesXML);
}