use of com.liferay.portal.kernel.model.Portlet in project sw360 by eclipse.
the class ProjectPortletUtils method createVulnerabilityFriendlyUrl.
public static String createVulnerabilityFriendlyUrl(ResourceRequest request) {
Portlet portlet = PortletLocalServiceUtil.getPortletById(PortalConstants.VULNERABILITIES_PORTLET_NAME);
Optional<Layout> layout = LayoutLocalServiceUtil.getLayouts(portlet.getCompanyId()).stream().filter(l -> ("/vulnerabilities").equals(l.getFriendlyURL())).findFirst();
if (layout.isPresent()) {
long plId = layout.get().getPlid();
LiferayPortletURL vulUrl = PortletURLFactoryUtil.create(request, PortalConstants.VULNERABILITIES_PORTLET_NAME, plId, PortletRequest.RENDER_PHASE);
vulUrl.setParameter(PortalConstants.PAGENAME, PortalConstants.PAGENAME_DETAIL);
vulUrl.setParameter(PortalConstants.VULNERABILITY_ID, "replacewithexternalid");
return vulUrl.toString();
}
return "";
}
use of com.liferay.portal.kernel.model.Portlet in project sw360 by eclipse.
the class ProjectPortletUtils method createProjectPortletUrlWithViewSizeFriendlyUrl.
public static String createProjectPortletUrlWithViewSizeFriendlyUrl(RenderRequest request, String projectId) {
Portlet portlet = PortletLocalServiceUtil.getPortletById(PortalConstants.PROJECT_PORTLET_NAME);
Optional<Layout> layout = LayoutLocalServiceUtil.getLayouts(portlet.getCompanyId()).stream().filter(l -> ("/projects").equals(l.getFriendlyURL())).findFirst();
if (layout.isPresent()) {
long plId = layout.get().getPlid();
LiferayPortletURL projUrl = PortletURLFactoryUtil.create(request, PortalConstants.PROJECT_PORTLET_NAME, plId, PortletRequest.RENDER_PHASE);
projUrl.setParameter(PortalConstants.PAGENAME, PortalConstants.PAGENAME_DETAIL);
projUrl.setParameter(PortalConstants.PROJECT_ID, projectId);
projUrl.setParameter(PortalConstants.VIEW_SIZE, "replacewithviewsize");
return projUrl.toString();
}
return "";
}
use of com.liferay.portal.kernel.model.Portlet in project sw360 by eclipse.
the class ModerationPortletUtils method getProjectPortletUrl.
private static LiferayPortletURL getProjectPortletUrl(PortletRequest request, String projectId) {
Portlet portlet = PortletLocalServiceUtil.getPortletById(PortalConstants.PROJECT_PORTLET_NAME);
Optional<Layout> layout = LayoutLocalServiceUtil.getLayouts(portlet.getCompanyId()).stream().filter(l -> ("/" + PortalConstants.PROJECTS.toLowerCase()).equals(l.getFriendlyURL())).findFirst();
if (layout.isPresent()) {
long plId = layout.get().getPlid();
LiferayPortletURL projectUrl = PortletURLFactoryUtil.create(request, PortalConstants.PROJECT_PORTLET_NAME, plId, PortletRequest.RENDER_PHASE);
projectUrl.setParameter(PortalConstants.PROJECT_ID, projectId);
projectUrl.setParameter(PortalConstants.PAGENAME, PortalConstants.PAGENAME_DETAIL);
return projectUrl;
}
return null;
}
use of com.liferay.portal.kernel.model.Portlet in project sw360 by eclipse.
the class ChangeLogsPortletUtils method getModerationPortletUrl.
private LiferayPortletURL getModerationPortletUrl(PortletRequest request) {
Portlet portlet = PortletLocalServiceUtil.getPortletById(PortalConstants.MODERATION_PORTLET_NAME);
Optional<Layout> layout = LayoutLocalServiceUtil.getLayouts(portlet.getCompanyId()).stream().filter(l -> ("/moderation").equals(l.getFriendlyURL())).findFirst();
if (layout.isPresent()) {
long plId = layout.get().getPlid();
LiferayPortletURL modUrl = PortletURLFactoryUtil.create(request, PortalConstants.MODERATION_PORTLET_NAME, plId, PortletRequest.RENDER_PHASE);
modUrl.setParameter(PortalConstants.PAGENAME, PortalConstants.PAGENAME_EDIT);
return modUrl;
}
return null;
}
use of com.liferay.portal.kernel.model.Portlet in project liferay-faces-bridge-ext by liferay.
the class HeaderRequestBridgeLiferayImpl method isPortletModeAllowed.
@Override
public boolean isPortletModeAllowed(PortletMode portletMode) {
boolean portletModeAllowed = super.isPortletModeAllowed(portletMode);
if (portletModeAllowed && PortletMode.EDIT.equals(portletMode)) {
ThemeDisplay themeDisplay = (ThemeDisplay) super.getAttribute(WebKeys.THEME_DISPLAY);
try {
Portlet portlet = (Portlet) getAttribute(WebKeys.RENDER_PORTLET);
if (portlet == null) {
com.liferay.portal.kernel.portlet.LiferayPortletRequest liferayPortletRequest = PortalUtil.getLiferayPortletRequest(getRequest());
if (liferayPortletRequest != null) {
portlet = liferayPortletRequest.getPortlet();
}
}
if (portlet == null) {
logger.warn("Unable to determine com.liferay.portal.kernel.model.Portlet from PortletRequest");
portletModeAllowed = !isUserInRole(RoleConstants.GUEST);
} else {
portletModeAllowed = PortletPermissionUtil.hasAccessPermission(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(), themeDisplay.getLayout(), portlet, portletMode);
}
} catch (PortalException portalException) {
logger.error(portalException);
portletModeAllowed = false;
}
}
return portletModeAllowed;
}
Aggregations