Example usage for com.liferay.portal.kernel.bean BeanParamUtil getLong

List of usage examples for com.liferay.portal.kernel.bean BeanParamUtil getLong

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.bean BeanParamUtil getLong.

Prototype

public static long getLong(Object bean, PortletRequest portletRequest, String param, long defaultValue) 

Source Link

Usage

From source file:com.liferay.bookmarks.web.internal.portlet.toolbar.contributor.BookmarksPortletToolbarContributor.java

License:Open Source License

private BookmarksFolder _getFolder(ThemeDisplay themeDisplay, PortletRequest portletRequest) {

    BookmarksFolder folder = (BookmarksFolder) portletRequest.getAttribute(BookmarksWebKeys.BOOKMARKS_FOLDER);

    if (folder != null) {
        return folder;
    }/*from w  ww.  j ava  2s .  com*/

    long rootFolderId = BookmarksFolderConstants.DEFAULT_PARENT_FOLDER_ID;

    try {
        BookmarksGroupServiceOverriddenConfiguration bookmarksGroupServiceOverriddenConfiguration = ConfigurationProviderUtil
                .getConfiguration(BookmarksGroupServiceOverriddenConfiguration.class,
                        new GroupServiceSettingsLocator(themeDisplay.getScopeGroupId(),
                                BookmarksConstants.SERVICE_NAME));

        rootFolderId = bookmarksGroupServiceOverriddenConfiguration.rootFolderId();
    } catch (ConfigurationException ce) {
        _log.error("Unable to obtain bookmarks root folder ID for group " + themeDisplay.getScopeGroupId());
    }

    long folderId = BeanParamUtil.getLong(folder, portletRequest, "folderId", rootFolderId);

    if (folderId != BookmarksFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
        try {
            folder = _bookmarksFolderService.getFolder(folderId);
        } catch (NoSuchFolderException nsfe) {
            folder = null;
        } catch (PortalException pe) {
            _log.error(pe, pe);
        }
    }

    return folder;
}

From source file:com.liferay.journal.web.internal.display.context.JournalDisplayContext.java

License:Open Source License

public long getFolderId() throws PortalException {
    if (_folderId != null) {
        return _folderId;
    }//from w w  w.  j  av  a 2  s  . com

    JournalFolder folder = getFolder();

    _folderId = BeanParamUtil.getLong(folder, _request, "folderId",
            JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID);

    return _folderId;
}

From source file:com.liferay.message.boards.web.internal.display.context.util.MBRequestHelper.java

License:Open Source License

public long getParentCategoryId() {
    if (_parentCategoryId == null) {
        MBCategory category = getCategory();

        _parentCategoryId = BeanParamUtil.getLong(category, getRequest(), "parentCategoryId",
                MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID);
    }/*w  w  w.  j  av a2  s  .c o m*/

    return _parentCategoryId;
}