Example usage for com.liferay.portal.kernel.portlet PortletPreferencesFactoryUtil getPortletPreferences

List of usage examples for com.liferay.portal.kernel.portlet PortletPreferencesFactoryUtil getPortletPreferences

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.portlet PortletPreferencesFactoryUtil getPortletPreferences.

Prototype

public static PortletPreferences getPortletPreferences(HttpServletRequest httpServletRequest, String portletId)
            throws PortalException 

Source Link

Usage

From source file:com.liferay.document.library.web.internal.portlet.action.ActionUtil.java

License:Open Source License

public static Folder getFolder(HttpServletRequest request) throws PortalException {

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    long folderId = ParamUtil.getLong(request, "folderId");

    boolean ignoreRootFolder = ParamUtil.getBoolean(request, "ignoreRootFolder");

    if ((folderId <= 0) && !ignoreRootFolder) {
        PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

        String portletId = portletDisplay.getId();

        PortletPreferences portletPreferences = PortletPreferencesFactoryUtil.getPortletPreferences(request,
                portletId);//from www .j  a v a  2 s  . c om

        folderId = GetterUtil.getLong(portletPreferences.getValue("rootFolderId", null));
    }

    Folder folder = null;

    if (folderId > 0) {
        folder = DLAppServiceUtil.getFolder(folderId);

        if (folder.getModel() instanceof DLFolder) {
            DLFolder dlFolder = (DLFolder) folder.getModel();

            if (dlFolder.isInTrash()) {
                throw new NoSuchFolderException("{folderId=" + folderId + "}");
            }
        }
    } else {
        DLPermission.check(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(),
                ActionKeys.VIEW);
    }

    return folder;
}

From source file:com.liferay.document.library.web.internal.util.IGUtil.java

License:Open Source License

protected static long getRootFolderId(HttpServletRequest request) throws Exception {

    PortletPreferences portletPreferences = PortletPreferencesFactoryUtil.getPortletPreferences(request,
            PortalUtil.getPortletId(request));

    return GetterUtil.getLong(portletPreferences.getValue("rootFolderId",
            String.valueOf(DLFolderConstants.DEFAULT_PARENT_FOLDER_ID)));
}

From source file:com.liferay.exportimport.web.internal.portlet.action.ActionUtil.java

License:Open Source License

protected static PortletPreferences getPortletPreferences(HttpServletRequest request,
        PortletPreferences portletConfigPortletPreferences, PortletPreferences portletPreferences)
        throws PortalException {

    String portletResource = ParamUtil.getString(request, "portletResource");

    if (Validator.isNull(portletResource)) {
        return portletConfigPortletPreferences;
    }// ww  w . j a v a2  s.c o  m

    if (portletPreferences != null) {
        return portletPreferences;
    }

    return PortletPreferencesFactoryUtil.getPortletPreferences(request, portletResource);
}

From source file:com.liferay.site.navigation.admin.web.internal.display.context.SiteNavigationAdminDisplayContext.java

License:Open Source License

public SiteNavigationAdminDisplayContext(LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse, HttpServletRequest request) throws PortalException {

    _liferayPortletRequest = liferayPortletRequest;
    _liferayPortletResponse = liferayPortletResponse;
    _request = request;/*from  w  w  w  . jav a  2  s . c o  m*/

    _portletPreferences = PortletPreferencesFactoryUtil.getPortletPreferences(request,
            SiteNavigationAdminPortletKeys.SITE_NAVIGATION_ADMIN);
    _siteNavigationMenuItemTypeRegistry = (SiteNavigationMenuItemTypeRegistry) _request
            .getAttribute(SiteNavigationAdminWebKeys.SITE_NAVIGATION_MENU_ITEM_TYPE_REGISTRY);
}