Example usage for com.liferay.portal.kernel.util PortalUtil getPlidFromPortletId

List of usage examples for com.liferay.portal.kernel.util PortalUtil getPlidFromPortletId

Introduction

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

Prototype

public static long getPlidFromPortletId(long groupId, String portletId) throws PortalException 

Source Link

Usage

From source file:com.liferay.asset.publisher.web.display.context.AssetPublisherDisplayContext.java

License:Open Source License

public Boolean isShowContextLink(long groupId, String portletId) throws PortalException {

    if (_showContextLink != null) {
        return _showContextLink;
    }//from ww  w . java  2  s .  c o m

    _showContextLink = isShowContextLink();

    if (_showContextLink && (PortalUtil.getPlidFromPortletId(groupId, portletId) == 0)) {

        _showContextLink = false;
    }

    return _showContextLink;
}

From source file:com.liferay.blogs.internal.trash.BlogsEntryTrashHandler.java

License:Open Source License

protected PortletURL getRestoreURL(PortletRequest portletRequest, long classPK, boolean containerModel)
        throws PortalException {

    PortletURL portletURL = null;/*from  w w w .ja va 2  s.c  o  m*/

    BlogsEntry entry = _blogsEntryLocalService.getEntry(classPK);
    String portletId = PortletProviderUtil.getPortletId(BlogsEntry.class.getName(),
            PortletProvider.Action.VIEW);

    long plid = PortalUtil.getPlidFromPortletId(entry.getGroupId(), portletId);

    if (plid == LayoutConstants.DEFAULT_PLID) {
        portletId = PortletProviderUtil.getPortletId(BlogsEntry.class.getName(), PortletProvider.Action.MANAGE);

        portletURL = PortalUtil.getControlPanelPortletURL(portletRequest, portletId,
                PortletRequest.RENDER_PHASE);
    } else {
        portletURL = PortletURLFactoryUtil.create(portletRequest, portletId, plid, PortletRequest.RENDER_PHASE);
    }

    if (!containerModel) {
        portletURL.setParameter("mvcRenderCommandName", "/blogs/view_entry");
    }

    return portletURL;
}

From source file:com.liferay.message.boards.internal.trash.MBCategoryTrashHandler.java

License:Open Source License

protected PortletURL getRestoreURL(PortletRequest portletRequest, long classPK) throws PortalException {

    PortletURL portletURL = null;// w ww .  java2  s  .c o m

    MBCategory category = _mbCategoryLocalService.getCategory(classPK);
    String portletId = PortletProviderUtil.getPortletId(MBCategory.class.getName(),
            PortletProvider.Action.EDIT);

    long plid = PortalUtil.getPlidFromPortletId(category.getGroupId(), portletId);

    if (plid == LayoutConstants.DEFAULT_PLID) {
        portletId = PortletProviderUtil.getPortletId(MBCategory.class.getName(), PortletProvider.Action.MANAGE);

        portletURL = PortalUtil.getControlPanelPortletURL(portletRequest, portletId,
                PortletRequest.RENDER_PHASE);
    } else {
        portletURL = PortletURLFactoryUtil.create(portletRequest, portletId, plid, PortletRequest.RENDER_PHASE);
    }

    portletURL.setParameter("mvcRenderCommandName", "/message_boards/view_category");

    return portletURL;
}

From source file:com.liferay.message.boards.internal.trash.MBThreadTrashHandler.java

License:Open Source License

protected PortletURL getRestoreURL(PortletRequest portletRequest, long classPK, boolean containerModel)
        throws PortalException {

    PortletURL portletURL = null;//from   ww w .jav a2  s.c o  m

    MBThread thread = _mbThreadLocalService.getThread(classPK);
    String portletId = PortletProviderUtil.getPortletId(MBThread.class.getName(), PortletProvider.Action.EDIT);

    long plid = PortalUtil.getPlidFromPortletId(thread.getGroupId(), portletId);

    if (plid == LayoutConstants.DEFAULT_PLID) {
        portletId = PortletProviderUtil.getPortletId(MBThread.class.getName(), PortletProvider.Action.MANAGE);

        portletURL = PortalUtil.getControlPanelPortletURL(portletRequest, portletId,
                PortletRequest.RENDER_PHASE);
    } else {
        portletURL = PortletURLFactoryUtil.create(portletRequest, portletId, plid, PortletRequest.RENDER_PHASE);
    }

    if (containerModel) {
        String mvcRenderCommandName = "/message_boards/view";

        if (thread.getCategoryId() != MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) {

            mvcRenderCommandName = "/message_boards/view_category";
        }

        portletURL.setParameter("mvcRenderCommandName", mvcRenderCommandName);
    } else {
        portletURL.setParameter("mvcRenderCommandName", "/message_boards/view_message");
    }

    return portletURL;
}

From source file:com.liferay.wiki.trash.WikiNodeTrashHandler.java

License:Open Source License

protected PortletURL getRestoreURL(PortletRequest portletRequest, long classPK, boolean containerModel)
        throws PortalException {

    PortletURL portletURL = null;/*  ww w  .j  a v a  2  s  .  co m*/

    WikiNode node = _wikiNodeLocalService.getNode(classPK);

    long plid = PortalUtil.getPlidFromPortletId(node.getGroupId(), WikiPortletKeys.WIKI);

    if (plid == LayoutConstants.DEFAULT_PLID) {
        portletURL = PortalUtil.getControlPanelPortletURL(portletRequest, WikiPortletKeys.WIKI_ADMIN,
                PortletRequest.RENDER_PHASE);
    } else {
        portletURL = PortletURLFactoryUtil.create(portletRequest, WikiPortletKeys.WIKI, plid,
                PortletRequest.RENDER_PHASE);
    }

    if (!containerModel) {
        portletURL.setParameter("mvcRenderCommandName", "/wiki/view_pages");
    }

    return portletURL;
}

From source file:com.liferay.wiki.trash.WikiPageTrashHandler.java

License:Open Source License

protected PortletURL getRestoreURL(PortletRequest portletRequest, long classPK, boolean containerModel)
        throws PortalException {

    PortletURL portletURL = null;//w  w w .j  av  a  2 s .  co m

    WikiPage page = _wikiPageLocalService.getLatestPage(classPK, WorkflowConstants.STATUS_ANY, false);

    long plid = PortalUtil.getPlidFromPortletId(page.getGroupId(), WikiPortletKeys.WIKI);

    if (plid == LayoutConstants.DEFAULT_PLID) {
        portletURL = PortalUtil.getControlPanelPortletURL(portletRequest, WikiPortletKeys.WIKI_ADMIN,
                PortletRequest.RENDER_PHASE);
    } else {
        portletURL = PortletURLFactoryUtil.create(portletRequest, WikiPortletKeys.WIKI, plid,
                PortletRequest.RENDER_PHASE);
    }

    if (containerModel) {
        portletURL.setParameter("mvcRenderCommandName", "/wiki/view_pages");
    } else {
        portletURL.setParameter("mvcRenderCommandName", "/wiki/view");
    }

    return portletURL;
}